giml-language-0.1.0.0: A purely functional programming language with emphasis on structural typing
Safe HaskellSafe-Inferred
LanguageGHC2021

Language.Giml.Types.Types

Description

Type definitions

Synopsis

Documentation

data Type Source #

A data type representing types

Constructors

TypeVar TypeVar

type variables, like a

TypeCon TypeCon

type constructors, like List and Int

TypeApp Type Type

type application, like List a

TypeRec [(Label, Type)]

the type of a record, like { x : Int, y : String }

TypeRecExt [(Label, Type)] TypeVar

a record with an extension, such as { x : Int, y : String | r }, means "this record has at least { x : Int, y : String }, but can have more fields"

TypeVariant [(Constr, Type)]

the type of a closed variant, such as [ Some : Int | Nil : {} ], the value can be one of the constructors.

TypePolyVariantLB [(Constr, Type)] TypeVar

the type of a lower bounded polymorphic variant, such as [a> Some : Int | Nil : {} ], the value can be at least one of the constructors or potentially more.

TypePolyVariantUB TypeVar [(Constr, Type)]

the type of a upper bounded polymorphic variant, such as [a< Some : Int | Nil : {} ], the value can be at most one of the constructors or potentially less.

The type variable here is special and is used to track the information of which variants we already know of during the type inference process.

TypeScheme [TypeVar] Type

A generalized type which closes over all of its type variables, such as forall a b. a -> b -> a

Instances

Instances details
Data Type Source # 
Instance details

Defined in Language.Giml.Types.Types

Methods

gfoldl :: (forall d b. Data d => c (d -> b) -> d -> c b) -> (forall g. g -> c g) -> Type -> c Type #

gunfold :: (forall b r. Data b => c (b -> r) -> c r) -> (forall r. r -> c r) -> Constr -> c Type #

toConstr :: Type -> Constr #

dataTypeOf :: Type -> DataType #

dataCast1 :: Typeable t => (forall d. Data d => c (t d)) -> Maybe (c Type) #

dataCast2 :: Typeable t => (forall d e. (Data d, Data e) => c (t d e)) -> Maybe (c Type) #

gmapT :: (forall b. Data b => b -> b) -> Type -> Type #

gmapQl :: (r -> r' -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r #

gmapQr :: forall r r'. (r' -> r -> r) -> r -> (forall d. Data d => d -> r') -> Type -> r #

gmapQ :: (forall d. Data d => d -> u) -> Type -> [u] #

gmapQi :: Int -> (forall d. Data d => d -> u) -> Type -> u #

gmapM :: Monad m => (forall d. Data d => d -> m d) -> Type -> m Type #

gmapMp :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type #

gmapMo :: MonadPlus m => (forall d. Data d => d -> m d) -> Type -> m Type #

Show Type Source # 
Instance details

Defined in Language.Giml.Types.Types

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

Eq Type Source # 
Instance details

Defined in Language.Giml.Types.Types

Methods

(==) :: Type -> Type -> Bool #

(/=) :: Type -> Type -> Bool #

Ord Type Source # 
Instance details

Defined in Language.Giml.Types.Types

Methods

compare :: Type -> Type -> Ordering #

(<) :: Type -> Type -> Bool #

(<=) :: Type -> Type -> Bool #

(>) :: Type -> Type -> Bool #

(>=) :: Type -> Type -> Bool #

max :: Type -> Type -> Type #

min :: Type -> Type -> Type #

Pretty Type Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Methods

pretty :: Type -> Doc ann #

prettyList :: [Type] -> Doc ann #