ltext-0.1.2.2: Parameterized file evaluator

Safe HaskellNone
LanguageHaskell2010

LText.Type

Contents

Synopsis

Type Grammar

data Type Source #

We're working in an implicitly quantified prenex-polymorphic type system, so trivial type expressions are also type schemes.

Constructors

Text 
TVar String 
TArrow Type Type 

Instances

Eq Type Source # 

Methods

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

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

Show Type Source # 

Methods

showsPrec :: Int -> Type -> ShowS #

show :: Type -> String #

showList :: [Type] -> ShowS #

IsType Type Source # 

Methods

freeTVars :: Type -> HashSet String Source #

applySubst :: Subst -> Type -> Type Source #

Kit Effects

data TypeError Source #

data TypeEnv Source #

Constructors

TypeEnv 

Fields

type MonadTypecheck m = (MonadState Context m, MonadReader TypeEnv m, MonadThrow m, MonadIO m) Source #

TypeChecking

newtype Subst Source #

Constructors

Subst 

Fields

Instances

class IsType t where Source #

Minimal complete definition

freeTVars, applySubst

Methods

freeTVars :: t -> HashSet String Source #

applySubst :: Subst -> t -> t Source #

Instances

data Scheme Source #

Constructors

Scheme 

Fields

varBind :: MonadTypecheck m => String -> Type -> m Subst Source #

Substitute n for t, given there's no collision

quantify :: MonadTypecheck m => Type -> m Scheme Source #

Where we don't want to include variables bound by our context

unQuantify :: MonadTypecheck m => Scheme -> m Type Source #

Replaces bound variables with fresh ones

Actual Typechecking

data ExprType Source #

Constructors

TopLevel 
DocLevel