glam
Safe HaskellSafe-Inferred
LanguageHaskell2010

Glam.Term

Description

Syntax and evaluation of terms.

Synopsis

Documentation

type Var = String Source #

Variables

type Subst = Map Var Term Source #

Substitutions

data Term Source #

Terms of the guarded λ-calculus

Constructors

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

operations

Box Term 
Unbox Term

operations

Instances

Instances details
Show Term Source # 
Instance details

Defined in Glam.Term

Methods

showsPrec :: Int -> Term -> ShowS #

show :: Term -> String #

showList :: [Term] -> ShowS #

Eq Term Source # 
Instance details

Defined in Glam.Term

Methods

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

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

Constant Term Source #

A term is constant if it only refers to constant terms or terms with a constant type.

Instance details

Defined in Glam.Rules.Term

Free variables

Evaluation

data Value Source #

Values are basically destructor-free terms, with abstractions represented in a higher-order way.

Instances

Instances details
Show Value Source # 
Instance details

Defined in Glam.Term

Methods

showsPrec :: Int -> Value -> ShowS #

show :: Value -> String #

showList :: [Value] -> ShowS #

intrec :: (a -> a) -> a -> (a -> a) -> Integer -> a Source #

eval :: Map Var Value -> Term -> Value Source #

Evaluate a term in the given environment.

Printing

showSubst :: Show a => Map [Char] a -> [Char] Source #

pad :: [Char] -> [Char] Source #

appPrec :: Num a => a Source #

plusPrec :: Num a => a Source #

Parsing