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

Safe HaskellNone
LanguageHaskell2010

Feldspar.Core.Frontend

Contents

Synopsis

Documentation

module Data.Patch

class Syntactic a

It is usually assumed that (desugar (sugar a)) has the same meaning as a.

Minimal complete definition

desugar, sugar

Associated Types

type Internal a :: *

Instances

Syntactic () 
Type a => Syntactic (Data a) 
Syntax a => Syntactic (Future a) 
Syntax a => Syntactic (M a) 
Syntax a => Syntactic (Ref a) 
Syntax a => Syntactic (IVar a) 
Syntax a => Syntactic (P a) 
Syntax a => Syntactic (Vector a) 
Unit a => Syntactic (BitVector a) 
Type a => Syntactic (Fix a) 
Syntax a => Syntactic (Option a) 
Syntax a => Syntactic (PushVector a) 
(Syntactic a, (~) (* -> *) (Domain a) dom, Syntactic b, (~) (* -> *) (Domain b) dom, IsHODomain dom p pVar, p (Internal a -> Internal b), p (Internal a), pVar (Internal a)) => Syntactic (a -> b) 
(Syntactic a, (~) (* -> *) (Domain a) dom, Syntactic b, (~) (* -> *) (Domain b) dom, TupleSat dom p, p (Internal a, Internal b), p (Internal a), p (Internal b), InjectC ((:||) Tuple p) dom (Internal a, Internal b), InjectC ((:||) Select p) dom (Internal a), InjectC ((:||) Select p) dom (Internal b)) => Syntactic (a, b) 
Syntactic (ASTF dom a) 
(Shape sh, Syntax a) => Syntactic (Vector sh a) 
(Syntactic a, (~) (* -> *) (Domain a) dom, Syntactic b, (~) (* -> *) (Domain b) dom, Syntactic c, (~) (* -> *) (Domain c) dom, TupleSat dom p, p (Internal a, Internal b, Internal c), p (Internal a), p (Internal b), p (Internal c), InjectC ((:||) Tuple p) dom (Internal a, Internal b, Internal c), InjectC ((:||) Select p) dom (Internal a), InjectC ((:||) Select p) dom (Internal b), InjectC ((:||) Select p) dom (Internal c)) => Syntactic (a, b, c) 
(Syntactic a, (~) (* -> *) (Domain a) dom, IsHODomain dom (Typeable *) pVar, InjectC (MONAD m) dom (m (Internal a)), Monad m, Typeable (* -> *) m, Typeable * (Internal a), pVar (Internal a)) => Syntactic (Mon dom m a) 
(Syntactic a, (~) (* -> *) (Domain a) dom, Syntactic b, (~) (* -> *) (Domain b) dom, Syntactic c, (~) (* -> *) (Domain c) dom, Syntactic d, (~) (* -> *) (Domain d) dom, TupleSat dom p, p (Internal a, Internal b, Internal c, Internal d), p (Internal a), p (Internal b), p (Internal c), p (Internal d), InjectC ((:||) Tuple p) dom (Internal a, Internal b, Internal c, Internal d), InjectC ((:||) Select p) dom (Internal a), InjectC ((:||) Select p) dom (Internal b), InjectC ((:||) Select p) dom (Internal c), InjectC ((:||) Select p) dom (Internal d)) => Syntactic (a, b, c, d) 
(Syntactic a, (~) (* -> *) (Domain a) dom, Syntactic b, (~) (* -> *) (Domain b) dom, Syntactic c, (~) (* -> *) (Domain c) dom, Syntactic d, (~) (* -> *) (Domain d) dom, Syntactic e, (~) (* -> *) (Domain e) dom, TupleSat dom p, p (Internal a, Internal b, Internal c, Internal d, Internal e), p (Internal a), p (Internal b), p (Internal c), p (Internal d), p (Internal e), InjectC ((:||) Tuple p) dom (Internal a, Internal b, Internal c, Internal d, Internal e), InjectC ((:||) Select p) dom (Internal a), InjectC ((:||) Select p) dom (Internal b), InjectC ((:||) Select p) dom (Internal c), InjectC ((:||) Select p) dom (Internal d), InjectC ((:||) Select p) dom (Internal e)) => Syntactic (a, b, c, d, e) 
(Syntactic a, (~) (* -> *) (Domain a) dom, Syntactic b, (~) (* -> *) (Domain b) dom, Syntactic c, (~) (* -> *) (Domain c) dom, Syntactic d, (~) (* -> *) (Domain d) dom, Syntactic e, (~) (* -> *) (Domain e) dom, Syntactic f, (~) (* -> *) (Domain f) dom, TupleSat dom p, p (Internal a, Internal b, Internal c, Internal d, Internal e, Internal f), p (Internal a), p (Internal b), p (Internal c), p (Internal d), p (Internal e), p (Internal f), InjectC ((:||) Tuple p) dom (Internal a, Internal b, Internal c, Internal d, Internal e, Internal f), InjectC ((:||) Select p) dom (Internal a), InjectC ((:||) Select p) dom (Internal b), InjectC ((:||) Select p) dom (Internal c), InjectC ((:||) Select p) dom (Internal d), InjectC ((:||) Select p) dom (Internal e), InjectC ((:||) Select p) dom (Internal f)) => Syntactic (a, b, c, d, e, f) 
(Syntactic a, (~) (* -> *) (Domain a) dom, Syntactic b, (~) (* -> *) (Domain b) dom, Syntactic c, (~) (* -> *) (Domain c) dom, Syntactic d, (~) (* -> *) (Domain d) dom, Syntactic e, (~) (* -> *) (Domain e) dom, Syntactic f, (~) (* -> *) (Domain f) dom, Syntactic g, (~) (* -> *) (Domain g) dom, TupleSat dom p, p (Internal a, Internal b, Internal c, Internal d, Internal e, Internal f, Internal g), p (Internal a), p (Internal b), p (Internal c), p (Internal d), p (Internal e), p (Internal f), p (Internal g), InjectC ((:||) Tuple p) dom (Internal a, Internal b, Internal c, Internal d, Internal e, Internal f, Internal g), InjectC ((:||) Select p) dom (Internal a), InjectC ((:||) Select p) dom (Internal b), InjectC ((:||) Select p) dom (Internal c), InjectC ((:||) Select p) dom (Internal d), InjectC ((:||) Select p) dom (Internal e), InjectC ((:||) Select p) dom (Internal f), InjectC ((:||) Select p) dom (Internal g)) => Syntactic (a, b, c, d, e, f, g) 

type family Internal a :: *

Instances

type Internal () = () 
type Internal (Data a) = a 
type Internal (Future a) = FVal (Internal a) 
type Internal (M a) = Mut (Internal a) 
type Internal (Ref a) = IORef (Internal a) 
type Internal (IVar a) = IV (Internal a) 
type Internal (P a) = Par (Internal a) 
type Internal (Vector a) = [Internal a] 
type Internal (BitVector a) = [a] 
type Internal (Fix a) = (IntN, a) 
type Internal (Option a) = (Bool, Internal a) 
type Internal (PushVector a) = [Internal a] 
type Internal (a -> b) = Internal a -> Internal b 
type Internal (a, b) = (Internal a, Internal b) 
type Internal (ASTF dom a) = a 
type Internal (Vector sh a) = ([Length], [Internal a]) 
type Internal (a, b, c) = (Internal a, Internal b, Internal c) 
type Internal (Mon dom m a) = m (Internal a) 
type Internal (a, b, c, d) = (Internal a, Internal b, Internal c, Internal d) 
type Internal (a, b, c, d, e) = (Internal a, Internal b, Internal c, Internal d, Internal e) 
type Internal (a, b, c, d, e, f) = (Internal a, Internal b, Internal c, Internal d, Internal e, Internal f) 
type Internal (a, b, c, d, e, f, g) = (Internal a, Internal b, Internal c, Internal d, Internal e, Internal f, Internal g) 

data Data a Source

Instances

Type a => Eq (Data a) 
Fraction a => Fractional (Data a) 
Numeric a => Num (Data a) 
Type a => Show (Data a) 
Testable (Data Bool) 
(Type a, Arbitrary a) => Arbitrary (Data a) 
Type a => Syntactic (Data a) 
Type a => Sized (Data [a]) 
Type a => Indexed (Data [a]) 
Fixable (Data Float) 
Type a => ElemWise (Data a) 
(Type a, Type b) => CollMap (Data [a]) (Data [b]) 
Numeric a => Mul (Data a) (Matrix a) 
Numeric a => Mul (Data a) (Vector1 a) 
Numeric a => Mul (Data a) (Data a) 
Numeric a => Mul (Vector1 a) (Matrix a) 
Numeric a => Mul (Vector1 a) (Vector1 a) 
Numeric a => Mul (Vector1 a) (Data a) 
Numeric a => Mul (Matrix a) (Matrix a) 
Numeric a => Mul (Matrix a) (Vector1 a) 
Numeric a => Mul (Matrix a) (Data a) 
Slice sl => Slice ((:.) sl (Data Length)) 
Shape sh => Shape ((:.) sh (Data Length)) 
Typeable (* -> *) Data 
type Internal (Data a) = a 
type Domain (Data a) = FeldDomain 
type CollSize (Data [a]) = Data Length 
type CollIndex (Data [a]) = Data Index 
type Elem (Data [a]) = Data a 
type Scalar (Data a) = Data a 
type Prod (Data a) (Matrix a) = Matrix a 
type Prod (Data a) (Vector1 a) = Vector1 a 
type Prod (Data a) (Data a) = Data a 
type Prod (Vector1 a) (Matrix a) = Vector1 a 
type Prod (Vector1 a) (Vector1 a) = Data a 
type Prod (Vector1 a) (Data a) = Vector1 a 
type Prod (Matrix a) (Matrix a) = Matrix a 
type Prod (Matrix a) (Vector1 a) = Vector1 a 
type Prod (Matrix a) (Data a) = Matrix a 
type SliceShape ((:.) sl (Data Length)) = SliceShape sl 
type FullShape ((:.) sl (Data Length)) = (:.) (FullShape sl) (Data Length) 

class (SyntacticFeld a, Type (Internal a)) => Syntax a Source

Specialization of the Syntactic class for the Feldspar domain

Instances

data FeldOpts Source

A record with options for explicit passing in rewrite rules.

defaultFeldOpts :: FeldOpts Source

Default options.

reifyFeld :: SyntacticFeld a => FeldOpts -> BitWidth n -> a -> ASTF (Decor Info FeldDom) (Internal a) Source

Reification and optimization of a Feldspar program

reifyFeldUnOpt :: SyntacticFeld a => FeldOpts -> BitWidth n -> a -> ASTF FeldDom (Internal a) Source

Reification of a Feldspar program

printExpr :: SyntacticFeld a => a -> IO () Source

Print an optimized expression

printExprWith :: SyntacticFeld a => FeldOpts -> a -> IO () Source

Print an optimized expression with options

printExprUnOpt :: SyntacticFeld a => a -> IO () Source

Print an unoptimized expression

showAST :: SyntacticFeld a => a -> String Source

Show the syntax tree using Unicode art

drawAST :: SyntacticFeld a => a -> IO () Source

Draw the syntax tree on the terminal using Unicode art

writeHtmlAST :: SyntacticFeld a => FilePath -> a -> IO () Source

Convert the syntax tree to an HTML file with foldable nodes

showDecor :: SyntacticFeld a => a -> String Source

Draw a syntax tree decorated with type and size information

drawDecor :: SyntacticFeld a => a -> IO () Source

Draw a syntax tree decorated with type and size information

desugar :: Syntax a => a -> Data (Internal a) Source

sugar :: Syntax a => Data (Internal a) -> a Source

resugar :: (Syntax a, Syntax b, Internal a ~ Internal b) => a -> b Source

QuickCheck

(===>) :: Testable prop => Data Bool -> prop -> Property Source

(====) :: Equal a => a -> a -> Property Source

Type constraints

tData :: Patch a a -> Patch (Data a) (Data a) Source

tArr1 :: Patch a a -> Patch (Data [a]) (Data [a]) Source

tArr2 :: Patch a a -> Patch (Data [[a]]) (Data [[a]]) Source

tM :: Patch a a -> Patch (M a) (M a) Source

Functions

ilog2 :: Bits a => Data a -> Data Index Source

Integer logarithm in base 2 Based on an algorithm in Hacker's Delight

nlz :: Bits a => Data a -> Data Index Source

Count leading zeros Based on an algorithm in Hacker's Delight