feldspar-language-0.7: A functional embedded language for DSP and parallelism

Safe HaskellNone
LanguageHaskell2010

Feldspar.Core.Constructs.Binding

Description

Interpretation of binding constructs

Synopsis

Documentation

optimizeLambda Source

Arguments

:: (CLambda Type :<: dom, OptimizeSuper dom) 
=> FeldOpts 
-> (ASTF (dom :|| Typeable) b -> Opt (ASTF (Decor Info (dom :|| Typeable)) b))

Optimization of the body

-> Info a 
-> CLambda Type (b :-> Full (a -> b)) 
-> Args (AST (dom :|| Typeable)) (b :-> Full (a -> b)) 
-> Opt (ASTF (Decor Info (dom :|| Typeable)) (a -> b)) 

optimizeFunction Source

Arguments

:: ((Variable :|| Type) :<: dom, CLambda Type :<: dom, Let :<: dom, OptimizeSuper dom) 
=> FeldOpts 
-> (ASTF (dom :|| Typeable) b -> Opt (ASTF (Decor Info (dom :|| Typeable)) b))

Optimization of the body

-> Info a 
-> ASTF (dom :|| Typeable) (a -> b) -> Opt (ASTF (Decor Info (dom :|| Typeable)) (a -> b)) 

Assumes that the expression is a Lambda

subst Source

Arguments

:: (Constrained dom, CLambda Type :<: dom, (Variable :|| Type) :<: dom) 
=> VarId

Variable to be substituted

-> ASTF (dom :|| Typeable) a

Expression to substitute for

-> ASTF (dom :|| Typeable) b

Expression to substitute in

-> ASTF (dom :|| Typeable) b 

betaReduce Source

Arguments

:: (Constrained dom, CLambda Type :<: dom, (Variable :|| Type) :<: dom) 
=> ASTF (dom :|| Typeable) a

Argument

-> ASTF (dom :|| Typeable) (a -> b)

Function to be reduced

-> ASTF (dom :|| Typeable) b 

prjLambda :: Project (CLambda Type) dom => dom sig -> Maybe (CLambda Type sig) Source

cLambda :: Type a => VarId -> CLambda Type (b :-> Full (a -> b)) Source

reuseCLambda :: CLambda Type (b :-> Full (a -> b)) -> CLambda Type (c :-> Full (a -> c)) Source

Allow an existing binding to be used with a body of a different type

collectLetBinders :: forall dom a. (Project Let dom, Project (CLambda Type) dom, ConstrainedBy dom Typeable) => ASTF dom a -> ([(VarId, ASTB dom Type)], ASTF dom a) Source

Collects the immediate let bindings in a list and returns the first non-let expression

This function can be useful when let bindings get in the way of pattern matching on a sub-expressions.