Safe Haskell | None |
---|---|
Language | Haskell2010 |
Data types for types
Synopsis
- type SourceType = Type SourceAnn
- type SourceConstraint = Constraint SourceAnn
- newtype SkolemScope = SkolemScope {}
- data Type a
- = TUnknown a Int
- | TypeVar a Text
- | TypeLevelString a PSString
- | TypeWildcard a (Maybe Text)
- | TypeConstructor a (Qualified (ProperName TypeName))
- | TypeOp a (Qualified (OpName TypeOpName))
- | TypeApp a (Type a) (Type a)
- | ForAll a Text (Maybe (Kind a)) (Type a) (Maybe SkolemScope)
- | ConstrainedType a (Constraint a) (Type a)
- | Skolem a Text Int SkolemScope
- | REmpty a
- | RCons a Label (Type a) (Type a)
- | KindedType a (Type a) (Kind a)
- | BinaryNoParensType a (Type a) (Type a) (Type a)
- | ParensInType a (Type a)
- srcTUnknown :: Int -> SourceType
- srcTypeVar :: Text -> SourceType
- srcTypeLevelString :: PSString -> SourceType
- srcTypeWildcard :: SourceType
- srcTypeConstructor :: Qualified (ProperName TypeName) -> SourceType
- srcTypeOp :: Qualified (OpName TypeOpName) -> SourceType
- srcTypeApp :: SourceType -> SourceType -> SourceType
- srcForAll :: Text -> Maybe SourceKind -> SourceType -> Maybe SkolemScope -> SourceType
- srcConstrainedType :: SourceConstraint -> SourceType -> SourceType
- srcSkolem :: Text -> Int -> SkolemScope -> SourceType
- srcREmpty :: SourceType
- srcRCons :: Label -> SourceType -> SourceType -> SourceType
- srcKindedType :: SourceType -> SourceKind -> SourceType
- srcBinaryNoParensType :: SourceType -> SourceType -> SourceType -> SourceType
- srcParensInType :: SourceType -> SourceType
- data ConstraintData = PartialConstraintData [[Text]] Bool
- data Constraint a = Constraint {}
- srcConstraint :: Qualified (ProperName ClassName) -> [SourceType] -> Maybe ConstraintData -> SourceConstraint
- mapConstraintArgs :: ([Type a] -> [Type a]) -> Constraint a -> Constraint a
- overConstraintArgs :: Functor f => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a)
- constraintDataToJSON :: ConstraintData -> Value
- constraintToJSON :: (a -> Value) -> Constraint a -> Value
- typeToJSON :: forall a. (a -> Value) -> Type a -> Value
- constraintDataFromJSON :: Value -> Parser ConstraintData
- constraintFromJSON :: forall a. Parser a -> (Value -> Parser a) -> Value -> Parser (Constraint a)
- typeFromJSON :: forall a. Parser a -> (Value -> Parser a) -> Value -> Parser (Type a)
- data RowListItem a = RowListItem {
- rowListAnn :: a
- rowListLabel :: Label
- rowListType :: Type a
- srcRowListItem :: Label -> SourceType -> RowListItem SourceAnn
- rowToList :: Type a -> ([RowListItem a], Type a)
- rowToSortedList :: Type a -> ([RowListItem a], Type a)
- rowFromList :: ([RowListItem a], Type a) -> Type a
- isMonoType :: Type a -> Bool
- mkForAll :: [(a, (Text, Maybe (Kind a)))] -> Type a -> Type a
- replaceTypeVars :: Text -> Type a -> Type a -> Type a
- replaceAllTypeVars :: [(Text, Type a)] -> Type a -> Type a
- usedTypeVariables :: Type a -> [Text]
- freeTypeVariables :: Type a -> [Text]
- quantify :: Type a -> Type a
- moveQuantifiersToFront :: Type a -> Type a
- containsWildcards :: Type a -> Bool
- containsForAll :: Type a -> Bool
- everywhereOnTypes :: (Type a -> Type a) -> Type a -> Type a
- everywhereOnTypesTopDown :: (Type a -> Type a) -> Type a -> Type a
- everywhereOnTypesM :: Monad m => (Type a -> m (Type a)) -> Type a -> m (Type a)
- everywhereOnTypesTopDownM :: Monad m => (Type a -> m (Type a)) -> Type a -> m (Type a)
- everythingOnTypes :: (r -> r -> r) -> (Type a -> r) -> Type a -> r
- everythingWithContextOnTypes :: s -> r -> (r -> r -> r) -> (s -> Type a -> (s, r)) -> Type a -> r
- annForType :: Lens' (Type a) a
- getAnnForType :: Type a -> a
- setAnnForType :: a -> Type a -> Type a
- eqType :: Type a -> Type b -> Bool
- compareType :: Type a -> Type b -> Ordering
- eqConstraint :: Constraint a -> Constraint b -> Bool
- compareConstraint :: Constraint a -> Constraint b -> Ordering
Documentation
type SourceType = Type SourceAnn Source #
type SourceConstraint = Constraint SourceAnn Source #
newtype SkolemScope Source #
An identifier for the scope of a skolem variable
Instances
The type of types
TUnknown a Int | A unification variable of type Type |
TypeVar a Text | A named type variable |
TypeLevelString a PSString | A type-level string |
TypeWildcard a (Maybe Text) | A type wildcard, as would appear in a partial type synonym |
TypeConstructor a (Qualified (ProperName TypeName)) | A type constructor |
TypeOp a (Qualified (OpName TypeOpName)) | A type operator. This will be desugared into a type constructor during the "operators" phase of desugaring. |
TypeApp a (Type a) (Type a) | A type application |
ForAll a Text (Maybe (Kind a)) (Type a) (Maybe SkolemScope) | Forall quantifier |
ConstrainedType a (Constraint a) (Type a) | A type with a set of type class constraints |
Skolem a Text Int SkolemScope | A skolem constant |
REmpty a | An empty row |
RCons a Label (Type a) (Type a) | A non-empty row |
KindedType a (Type a) (Kind a) | A type with a kind annotation |
BinaryNoParensType a (Type a) (Type a) (Type a) | Binary operator application. During the rebracketing phase of desugaring, this data constructor will be removed. |
ParensInType a (Type a) | Explicit parentheses. During the rebracketing phase of desugaring, this data constructor will be removed. Note: although it seems this constructor is not used, it _is_ useful, since it prevents certain traversals from matching. |
Instances
srcTUnknown :: Int -> SourceType Source #
srcTypeVar :: Text -> SourceType Source #
srcTypeOp :: Qualified (OpName TypeOpName) -> SourceType Source #
srcTypeApp :: SourceType -> SourceType -> SourceType Source #
srcForAll :: Text -> Maybe SourceKind -> SourceType -> Maybe SkolemScope -> SourceType Source #
srcSkolem :: Text -> Int -> SkolemScope -> SourceType Source #
srcRCons :: Label -> SourceType -> SourceType -> SourceType Source #
srcKindedType :: SourceType -> SourceKind -> SourceType Source #
srcBinaryNoParensType :: SourceType -> SourceType -> SourceType -> SourceType Source #
data ConstraintData Source #
Additional data relevant to type class constraints
PartialConstraintData [[Text]] Bool | Data to accompany a Partial constraint generated by the exhaustivity checker.
It contains (rendered) binder information for those binders which were
not matched, and a flag indicating whether the list was truncated or not.
Note: we use |
Instances
data Constraint a Source #
A typeclass constraint
Constraint | |
|
Instances
srcConstraint :: Qualified (ProperName ClassName) -> [SourceType] -> Maybe ConstraintData -> SourceConstraint Source #
mapConstraintArgs :: ([Type a] -> [Type a]) -> Constraint a -> Constraint a Source #
overConstraintArgs :: Functor f => ([Type a] -> f [Type a]) -> Constraint a -> f (Constraint a) Source #
constraintToJSON :: (a -> Value) -> Constraint a -> Value Source #
constraintFromJSON :: forall a. Parser a -> (Value -> Parser a) -> Value -> Parser (Constraint a) Source #
data RowListItem a Source #
RowListItem | |
|
Instances
srcRowListItem :: Label -> SourceType -> RowListItem SourceAnn Source #
rowToList :: Type a -> ([RowListItem a], Type a) Source #
Convert a row to a list of pairs of labels and types
rowToSortedList :: Type a -> ([RowListItem a], Type a) Source #
Convert a row to a list of pairs of labels and types, sorted by the labels.
rowFromList :: ([RowListItem a], Type a) -> Type a Source #
Convert a list of labels and types to a row
isMonoType :: Type a -> Bool Source #
Check whether a type is a monotype
replaceTypeVars :: Text -> Type a -> Type a -> Type a Source #
Replace a type variable, taking into account variable shadowing
replaceAllTypeVars :: [(Text, Type a)] -> Type a -> Type a Source #
Replace named type variables with types
usedTypeVariables :: Type a -> [Text] Source #
Collect all type variables appearing in a type
freeTypeVariables :: Type a -> [Text] Source #
Collect all free type variables appearing in a type
quantify :: Type a -> Type a Source #
Universally quantify over all type variables appearing free in a type
moveQuantifiersToFront :: Type a -> Type a Source #
Move all universal quantifiers to the front of a type
containsWildcards :: Type a -> Bool Source #
Check if a type contains wildcards
containsForAll :: Type a -> Bool Source #
Check if a type contains forall
everythingOnTypes :: (r -> r -> r) -> (Type a -> r) -> Type a -> r Source #
everythingWithContextOnTypes :: s -> r -> (r -> r -> r) -> (s -> Type a -> (s, r)) -> Type a -> r Source #
annForType :: Lens' (Type a) a Source #
getAnnForType :: Type a -> a Source #
setAnnForType :: a -> Type a -> Type a Source #
eqConstraint :: Constraint a -> Constraint b -> Bool Source #
compareConstraint :: Constraint a -> Constraint b -> Ordering Source #