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

Language.Giml.Types.Infer.Types

Description

Utility types for type inference

Synopsis

Types

type InputAnn = Ann Source #

The annotation of the input

data Ann Source #

The annotation of the output: the input + the type

Constructors

Ann 

Fields

Instances

Instances details
Data Ann Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Methods

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

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

toConstr :: Ann -> Constr #

dataTypeOf :: Ann -> DataType #

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

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

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

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

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

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

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

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

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

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

Show Ann Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Methods

showsPrec :: Int -> Ann -> ShowS #

show :: Ann -> String #

showList :: [Ann] -> ShowS #

Eq Ann Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Methods

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

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

Ord Ann Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Methods

compare :: Ann -> Ann -> Ordering #

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

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

(>) :: Ann -> Ann -> Bool #

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

max :: Ann -> Ann -> Ann #

min :: Ann -> Ann -> Ann #

Pretty Ann Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Methods

pretty :: Ann -> Doc ann #

prettyList :: [Ann] -> Doc ann #

data Constraint Source #

Represents the constraints on types we collect during the elaboration phase.

Constructors

Equality Type Type

The two type should be equal.

Instances

Instances details
Data Constraint Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Methods

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

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

toConstr :: Constraint -> Constr #

dataTypeOf :: Constraint -> DataType #

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

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

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

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

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

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

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

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

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

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

Show Constraint Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Eq Constraint Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Ord Constraint Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Pretty Constraint Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Methods

pretty :: Constraint -> Doc ann #

prettyList :: [Constraint] -> Doc ann #

type ConstraintA = (Constraint, InputAnn) Source #

A constraint with the input annotation.

type Constraints = Set ConstraintA Source #

A Set of constraints.

type Substitution = Map TypeVar (InputAnn, Type) Source #

A mapping from type variable to types. Also contains the source position for error reporting. This is the output of the constraint solving phase.

data VariantSig a Source #

Relevant information about a data constructor.

Constructors

VariantSig 

Instances

Instances details
Data a => Data (VariantSig a) Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Methods

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

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

toConstr :: VariantSig a -> Constr #

dataTypeOf :: VariantSig a -> DataType #

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

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

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

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

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

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

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

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

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

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

Show a => Show (VariantSig a) Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Eq a => Eq (VariantSig a) Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Methods

(==) :: VariantSig a -> VariantSig a -> Bool #

(/=) :: VariantSig a -> VariantSig a -> Bool #

Ord a => Ord (VariantSig a) Source # 
Instance details

Defined in Language.Giml.Types.Infer.Types

Utils

throwErr :: MonadError TypeErrorA m => [InputAnn] -> TypeError -> m a Source #

Throw an error with annotation.

getType :: Expr Ann -> Type Source #

Retrieve the type of an expression. Will explode when used on a non EAnnotated node.

Pretty printing

ppShow :: Pretty ann => Functor f => Show (f Text) => f ann -> Text Source #

ppAnn :: Ann -> Doc ann Source #

Orphan instances

Pretty Type Source # 
Instance details

Methods

pretty :: Type -> Doc ann #

prettyList :: [Type] -> Doc ann #

Pretty SourcePos Source # 
Instance details

Methods

pretty :: SourcePos -> Doc ann #

prettyList :: [SourcePos] -> Doc ann #