flocc-pffb

Stabilityexperimental
Maintainerdeveloper@flocc.net
Safe HaskellNone

Compiler.Types2.TypeAssignment

Description

For more information please see http://www.flocc.net/

Synopsis

Documentation

assignTypes :: Monad a => TyEnv -> Expr -> StateT IdxSet a TyEnv

Takes an initial (global) type environment, and an expression |and returns a type environment mapping all expression ids to |type terms.

assignNewTypes :: Monad a => TyEnv -> TyEnv -> Expr -> StateT IdxSet a TyEnv

assignNewTypes takes the global type environment, a type environment giving type |assignments for some of the sub expressions, and an expression and returns |a type environment mapping expression ids to type schemes.

typeOfVal :: Val -> TyTerm

Returns the type of a literal value

data ExpLbl

Constructors

ProdLbl Idx 
IfLbl Idx 

data TyToken

Token type for type term language

Constructors

Ty String 

showGlobalTypeTerms :: String

Handy pretty printer to help make sense of the global dependence term environment

showTyScheme :: TyScheme -> String

Pretty print type scheme

rel :: TyTerm -> TyTerm -> TyTerm

The first var is the value term, and the second is the structure term

getTupleAccessorFun :: Int -> Int -> (String, Idx)

getTupleAccessorFun takes the tuple size and tuple length |and returns the function-name and var id of the tuple |accessor function.

typeSchemesToTerms :: Map Idx TyScheme -> Map Idx TyTerm

typeSchemesToTermsassignNewTypes transforms a map of type schemes, to type terms |but raises an error if any polymorphic type schemes remain.

typeName :: TyTerm -> Maybe String

typeName takes a type and returns the type name.

findDefaultSubsts :: TyEnv -> Substs TyTerm

findDefaultSubsts takes some type terms and returns a list of |substitutions for those type vars that should be replaced with default values.