Safe Haskell | None |
---|
Data types for types
- data Type
- = TUnknown (TypedUnknown Type)
- | Number
- | String
- | Boolean
- | Array
- | Object Type
- | Function [Type] Type
- | TypeVar String
- | TypeConstructor (Qualified ProperName)
- | TypeApp Type Type
- | SaturatedTypeSynonym (Qualified ProperName) [Type]
- | ForAll String Type
- | ConstrainedType [(Qualified ProperName, Type)] Type
- | Skolem Int
- | REmpty
- | RCons String Type Type
- rowToList :: Type -> ([(String, Type)], Type)
- rowFromList :: ([(String, Type)], Type) -> Type
- isMonoType :: Type -> Bool
- isPolyType :: Type -> Bool
- mkForAll :: [String] -> Type -> Type
- unit :: Type
- replaceTypeVars :: Data d => String -> Type -> d -> d
Documentation
The type of types
TUnknown (TypedUnknown Type) | A unification variable of type Type |
Number | Javascript numbers |
String | Javascript strings |
Boolean | Javascript booleans |
Array | Javascript array type constructor |
Object Type | Records, parameterized by a row of types |
Function [Type] Type | A function, with zero or more arguments |
TypeVar String | A named type variable |
TypeConstructor (Qualified ProperName) | A type constructor |
TypeApp Type Type | A type application |
SaturatedTypeSynonym (Qualified ProperName) [Type] | A type synonym which is "saturated", i.e. fully applied |
ForAll String Type | Forall quantifier |
ConstrainedType [(Qualified ProperName, Type)] Type | A type with a set of type class constraints |
Skolem Int | A skolem constant |
REmpty | An empty row |
RCons String Type Type | A non-empty row |
rowToList :: Type -> ([(String, Type)], Type)Source
Convert a row to a list of pairs of labels and types
isMonoType :: Type -> BoolSource
Check whether a type is a monotype
isPolyType :: Type -> BoolSource
Check whather a type is a valid polytype
replaceTypeVars :: Data d => String -> Type -> d -> dSource
Replace a type variable, taking into account variable shadowing