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

Feldspar.DSL.Expression

Description

This module defines the concept of expressions and expression transformers.

An expression is a type constructor of kind

 * -> * -> *

where the first argument denotes the "role" of the expression, and the second argument is the type of the value computed by the expression.

An expression transformer is a type constructor of kind

 (* -> * -> *) -> (* -> * -> *)

i.e. a expression parameterized by an expression.

Synopsis

Documentation

data Empty role a Source

Expression type with no constructors. Can be used to turn an expression transformer to an expression.

Instances

class ExprEq expr whereSource

Equality for expressions. The difference between Eq and ExprEq is that ExprEq allows comparison of expressions with different role and value type. It is assumed that when the types differ, the expressions also differ. The reason for allowing comparison of different types is that this is convenient when the types are existentially quantified.

Methods

exprEq :: expr ra a -> expr rb b -> BoolSource

Instances

ExprEq Empty 
ExprEq Val 
ExprEq Feldspar 
ExprEq expr => ExprEq (Lam expr) 
ExprEq node => ExprEq (Connection edge node) 

class Eval expr whereSource

Evaluation of expressions

Methods

eval :: expr role a -> aSource

Instances

Eval Empty 
Eval Val 
Eval Feldspar 
Eval expr => Eval (Lam expr) 
Eval node => Eval (Connection edge node) 

class ExprShow expr whereSource

Methods

exprShow :: expr role a -> StringSource

Instances

printExpr :: ExprShow expr => expr role a -> IO ()Source

exprCast :: forall expr ra a rb b. (Typeable ra, Typeable a, Typeable rb, Typeable b) => expr ra a -> Maybe (expr rb b)Source

Type-safe cast for expressions