syntactic-0.2.0.1: Generic abstract syntax, and utilities for embedded languages

Language.Syntactic.Features.Binding

Description

General binding constructs

Synopsis

Documentation

newtype VarId Source

Variable identifier

Constructors

VarId 

Fields

varInteger :: Integer
 

data Variable a whereSource

Variables

Constructors

Variable :: Typeable a => VarId -> Variable (Full a) 

data Lambda a whereSource

Lambda binding

Constructors

Lambda :: (Typeable a, Typeable b) => VarId -> Lambda (b :-> Full (a -> b)) 

eqLambdaM :: ExprEq dom => AST (Lambda :+: (Variable :+: dom)) a -> AST (Lambda :+: (Variable :+: dom)) b -> Reader [(VarId, VarId)] BoolSource

Alpha-equivalence on Lambda expressions. Free variables are taken to be equvalent if they have the same identifier.

eqLambda :: ExprEq dom => AST (Lambda :+: (Variable :+: dom)) a -> AST (Lambda :+: (Variable :+: dom)) b -> BoolSource

evalLambdaM :: (Eval dom, MonadReader [(VarId, Dynamic)] m) => ASTF (Lambda :+: (Variable :+: dom)) a -> m aSource

Evaluation of possibly open LambdaAST expressions

evalLambda :: Eval dom => ASTF (Lambda :+: (Variable :+: dom)) a -> aSource

Evaluation of closed Lambda expressions

class NAry a dom | a -> dom whereSource

The class of n-ary binding functions

Associated Types

type NAryEval a Source

Methods

bindN :: (forall b c. (Typeable b, Typeable c) => (ASTF dom b -> ASTF dom c) -> ASTF dom (b -> c)) -> a -> ASTF dom (NAryEval a)Source

N-ary binding by nested use of the supplied binder

Instances

(Typeable a, NAry b dom, Typeable (NAryEval b)) => NAry (ASTF dom a -> b) dom 
NAry (ASTF dom a) dom 

data Let a whereSource

Let binding

Constructors

Let :: Let (a :-> ((a -> b) :-> Full b))