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

Safe HaskellNone

Feldspar.Core.Frontend

Contents

Synopsis

Documentation

module Data.Patch

class Syntactic a

Associated Types

type Internal a1 :: *

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, Typeable1 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 a1 :: *

data FeldDomain a Source

Instances

Constrained FeldDomain 
Project sym FeldSymbols => Project sym FeldDomain 
TupleSat FeldDomain Type 
(InjectC sym FeldSymbols a, Typeable a) => InjectC sym FeldDomain a 
IsHODomain FeldDomain Typeable Type 

data Data a Source

Instances

Typeable1 Data 
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 => Sized (Data [a]) 
Type a => Indexed (Data [a]) 
Type a => Syntactic (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)) 

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 :: FeldOptsSource

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 -> StringSource

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 -> StringSource

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

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

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

QuickCheck

(===>) :: Testable prop => Data Bool -> prop -> PropertySource

(====) :: Equal a => a -> a -> PropertySource

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 IndexSource

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

nlz :: Bits a => Data a -> Data IndexSource

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