liboleg-2010.1.6.1: An evolving collection of Oleg Kiselyov's Haskell modules

Language.TEval.TInfT

Description

Simply-typed Curry-style (nominal) lambda-calculus with integers and zero-comparison Type inference

http://okmij.org/ftp/Computation/Computation.html#teval

Synopsis

Documentation

data Typ Source

Constructors

TInt 
!Typ :> !Typ 
TV TVarName 

Instances

type TEnv = [(VarName, Typ)]Source

Type Environment: associating types with free term variables

data TVE Source

Constructors

TVE Int (IntMap Typ) 

Instances

tvsub :: TVE -> Typ -> TypSource

Type variables are logic variables: hypothetical reasoning

tvchase :: TVE -> Typ -> TypSource

shallow substitution; check if tv is bound to anything substantial

unify :: Typ -> Typ -> TVE -> Either String TVESource

The unification. If unification failed, return the reason

unify' :: Typ -> Typ -> TVE -> Either String TVESource

If either t1 or t2 are type variables, they are definitely unbound

unifyv :: TVarName -> Typ -> TVE -> Either String TVESource

Unify a free variable v1 with t2

occurs :: TVarName -> Typ -> TVE -> BoolSource

The occurs check: if v appears free in t

teval' :: TEnv -> Term -> TVE -> (Typ, TVE)Source

Type reconstruction: abstract evaluation

teval :: TEnv -> Term -> TypSource

Resolve all type variables, as far as possible