Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Syntax and evaluation of terms.
Synopsis
- type Var = String
- type Subst = Map Var Term
- data Term
- = Var Var
- | Int Integer
- | Plus Term Term
- | Minus Term Term
- | Times Term Term
- | Divide Term Term
- | IntRec
- | Unit
- | Pair Term Term
- | Fst Term
- | Snd Term
- | Abort Term
- | InL Term
- | InR Term
- | Case Term Term Term
- | Abs Var Term
- | Term :$: Term
- | Let Subst Term
- | Fold Term
- | Unfold Term
- | Fix Term
- | Next Term
- | Prev Term
- | Term :<*>: Term
- | Box Term
- | Unbox Term
- freeVars :: Term -> Set Var
- freeIn :: Var -> Term -> Bool
- data Value
- intrec :: (a -> a) -> a -> (a -> a) -> Integer -> a
- eval :: Map Var Value -> Term -> Value
- showSubst :: Show a => Map [Char] a -> [Char]
- pad :: [Char] -> [Char]
- appPrec :: Num a => a
- plusPrec :: Num a => a
- variable :: Parser Var
- term :: Parser Term
- binding :: Parser (Var, Term)
- subst :: Parser Subst
Documentation
Terms of the guarded λ-calculus
Var Var | Variables |
Int Integer | |
Plus Term Term | |
Minus Term Term | |
Times Term Term | |
Divide Term Term | |
IntRec | Integers |
Unit | |
Pair Term Term | |
Fst Term | |
Snd Term | Products |
Abort Term | |
InL Term | |
InR Term | |
Case Term Term Term | Sums |
Abs Var Term | |
Term :$: Term infixl 9 | Functions |
Let Subst Term | Let-bindings |
Fold Term | |
Unfold Term | |
Fix Term | Guarded recursion |
Next Term | |
Prev Term | |
Term :<*>: Term infixl 9 |
|
Box Term | |
Unbox Term |
|
Free variables
Evaluation
Values are basically destructor-free terms, with abstractions represented in a higher-order way.