syntactic-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)) 

eqLambda :: 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.

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

Evaluation of possibly open LambdaAST expressions

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

Evaluation of closed Lambda expressions

class NAry a whereSource

The class of n-ary binding functions

Associated Types

type NAryEval a Source

type NAryDom a :: * -> *Source

Methods

bindN :: (forall b c. (Typeable b, Typeable c) => (AST (NAryDom a) (Full b) -> AST (NAryDom a) (Full c)) -> AST (NAryDom a) (Full (b -> c))) -> a -> AST (NAryDom a) (Full (NAryEval a))Source

N-ary binding by nested use of the supplied binder

Instances

(NAryDom b ~ dom, Typeable a, NAry b, Typeable (NAryEval b)) => NAry (AST dom (Full a) -> b) 
NAry (AST dom (Full a)) 

data Let a whereSource

Let binding

Constructors

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