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

Safe HaskellNone
LanguageHaskell2010

Feldspar.Core.Types

Contents

Synopsis

Heterogenous lists

data a :> b infixr 5 Source

Heterogeneous list

Constructors

a :> b infixr 5 

Instances

(Eq a, Eq b) => Eq ((:>) a b) 
(Ord a, Ord b) => Ord ((:>) a b) 
(Show a, Show b) => Show ((:>) a b) 
(Lattice a, Lattice b) => Lattice ((:>) a b) 

Integers

data N8 Source

Type representation of 8 bits

Instances

type GenericInt S N8 = Int8 
type GenericInt U N8 = Word8 

data N16 Source

Type representation of 16 bits

Instances

data N32 Source

Type representation of 32 bits

Instances

data N64 Source

Type representation of 64 bits

Instances

data NNative Source

Type representation of the native number of bits on the target

Instances

data BitWidth n where Source

Witness for N8, N16, N32, N64 or NNative

data U Source

Type representation of "unsigned"

Instances

data S Source

Type representation of "signed"

Instances

data Signedness s where Source

Witness for U or S

Constructors

U :: Signedness U 
S :: Signedness S 

type family GenericInt s n Source

A generalization of unsigned and signed integers. The first parameter represents the signedness and the sectond parameter the number of bits.

type family WidthOf a Source

Instances

type WidthOf Int8 = N8 
type WidthOf Int16 = N16 
type WidthOf Int32 = N32 
type WidthOf Int64 = N64 
type WidthOf Word8 = N8 
type WidthOf Word16 = N16 
type WidthOf Word32 = N32 
type WidthOf Word64 = N64 
type WidthOf IntN = NNative 
type WidthOf WordN = NNative 

type family SignOf a Source

Instances

type SignOf Int8 = S 
type SignOf Int16 = S 
type SignOf Int32 = S 
type SignOf Int64 = S 
type SignOf Word8 = U 
type SignOf Word16 = U 
type SignOf Word32 = U 
type SignOf Word64 = U 
type SignOf IntN = S 
type SignOf WordN = U 

Arrays

data TargetArr n a Source

Array whose length is represented by an n-bit word

Constructors

TargetArr (GenericInt U n) [a] 

Instances

type Size (TargetArr n a) = (:>) (Range (GenericInt U n)) (Size a) 

Monadic Types

class MonadType m where Source

This class is used to allow constructs to be abstract in the monad

Methods

voidTypeRep :: TypeRep (m ()) Source

Mutable data

type Mut = IO Source

Monad for manipulation of mutable data

type MArr a = IOArray Index a Source

Mutable arrays

Par Monad

type Par = Par Source

Monad for parallel constructs

type IV = IVar Source

Immutable references

Future values

newtype FVal a Source

Constructors

FVal 

Fields

unFVal :: a
 

Instances

Eq a => Eq (FVal a) 
Show (FVal a) 
Type a => Type (FVal a) 
Typeable (* -> *) FVal 
type TargetType n (FVal a) = FVal (TargetType n a) 
type Size (FVal a) = Size a 

Type representation

data TypeRep a where Source

Representation of supported types

Constructors

UnitType :: TypeRep () 
BoolType :: TypeRep Bool 
IntType :: (BoundedInt (GenericInt s n), Size (GenericInt s n) ~ Range (GenericInt s n)) => Signedness s -> BitWidth n -> TypeRep (GenericInt s n) 
FloatType :: TypeRep Float 
DoubleType :: TypeRep Double 
ComplexType :: RealFloat a => TypeRep a -> TypeRep (Complex a) 
ArrayType :: TypeRep a -> TypeRep [a] 
TargetArrType :: BitWidth n -> TypeRep a -> TypeRep (TargetArr n a) 
Tup2Type :: TypeRep a -> TypeRep b -> TypeRep (a, b) 
Tup3Type :: TypeRep a -> TypeRep b -> TypeRep c -> TypeRep (a, b, c) 
Tup4Type :: TypeRep a -> TypeRep b -> TypeRep c -> TypeRep d -> TypeRep (a, b, c, d) 
Tup5Type :: TypeRep a -> TypeRep b -> TypeRep c -> TypeRep d -> TypeRep e -> TypeRep (a, b, c, d, e) 
Tup6Type :: TypeRep a -> TypeRep b -> TypeRep c -> TypeRep d -> TypeRep e -> TypeRep f -> TypeRep (a, b, c, d, e, f) 
Tup7Type :: TypeRep a -> TypeRep b -> TypeRep c -> TypeRep d -> TypeRep e -> TypeRep f -> TypeRep g -> TypeRep (a, b, c, d, e, f, g) 
FunType :: TypeRep a -> TypeRep b -> TypeRep (a -> b) 
MutType :: TypeRep a -> TypeRep (Mut a) 
RefType :: TypeRep a -> TypeRep (IORef a) 
MArrType :: TypeRep a -> TypeRep (MArr a) 
ParType :: TypeRep a -> TypeRep (Par a) 
IVarType :: TypeRep a -> TypeRep (IV a) 
FValType :: TypeRep a -> TypeRep (FVal a) 

Instances

argType :: TypeRep (a -> b) -> TypeRep a Source

resType :: TypeRep (a -> b) -> TypeRep b Source

data TypeEq a b where Source

Type equality witness

Constructors

TypeEq :: TypeEq a a 

signEq :: Signedness s1 -> Signedness s2 -> Maybe (TypeEq s1 s2) Source

Type equality on Signedness

widthEq :: BitWidth n1 -> BitWidth n2 -> Maybe (TypeEq n1 n2) Source

Type equality on BitWidth

typeEq :: TypeRep a -> TypeRep b -> Maybe (TypeEq a b) Source

Type equality on TypeRep

type family TargetType n a Source

Instances

type TargetType n Double = Double 
type TargetType n Float = Float 
type TargetType n IntN = GenericInt S n 
type TargetType n WordN = GenericInt U n 
type TargetType n Int64 = Int64 
type TargetType n Word64 = Word64 
type TargetType n Int32 = Int32 
type TargetType n Word32 = Word32 
type TargetType n Int16 = Int16 
type TargetType n Word16 = Word16 
type TargetType n Int8 = Int8 
type TargetType n Word8 = Word8 
type TargetType n Bool = Bool 
type TargetType n () = () 
type TargetType n (FVal a) = FVal (TargetType n a) 
type TargetType n (IV a) = IV (TargetType n a) 
type TargetType n (MArr a) = MArr (TargetType n a) 
type TargetType n (IORef a) = IORef (TargetType n a) 
type TargetType n [a] = TargetArr n (TargetType n a) 
type TargetType n (Complex a) = Complex (TargetType n a) 
type TargetType n (a, b) = (TargetType n a, TargetType n b) 
type TargetType n (a, b, c) = (TargetType n a, TargetType n b, TargetType n c) 
type TargetType n (a, b, c, d) = (TargetType n a, TargetType n b, TargetType n c, TargetType n d) 
type TargetType n (a, b, c, d, e) = (TargetType n a, TargetType n b, TargetType n c, TargetType n d, TargetType n e) 
type TargetType n (a, b, c, d, e, f) = (TargetType n a, TargetType n b, TargetType n c, TargetType n d, TargetType n e, TargetType n f) 
type TargetType n (a, b, c, d, e, f, g) = (TargetType n a, TargetType n b, TargetType n c, TargetType n d, TargetType n e, TargetType n f, TargetType n g) 

class (Eq a, Show a, Typeable a, Show (Size a), Lattice (Size a)) => Type a where Source

The set of supported types

Methods

typeRep :: TypeRep a Source

Gives the type representation a value.

sizeOf :: a -> Size a Source

toTarget :: BitWidth n -> a -> TargetType n a Source

Instances

Type Bool 
Type Double 
Type Float 
Type Int8 
Type Int16 
Type Int32 
Type Int64 
Type Word8 
Type Word16 
Type Word32 
Type Word64 
Type () 
Type IntN 
Type WordN 
TupleSat FeldDomain Type 
IsHODomain FeldDomain (Typeable *) Type 
Type a => Type [a] 
(Type a, RealFloat a) => Type (Complex a) 
(Type a, Show (IORef a)) => Type (IORef a) 
Type a => Type (FVal a) 
Type a => Type (IV a) 
Type a => Type (MArr a) 
((:<:) (CLambda Type) dom, OptimizeSuper dom) => Optimize (CLambda Type) dom 
(Type a, Type b) => Type (a, b) 
Typed ((:||) sub Type) 
SizeProp ((:||) Select Type) 
SizeProp ((:||) Tuple Type) 
SizeProp ((:||) Literal Type) 
SizeProp ((:||) (Decor SourceInfo1 Identity) Type) 
SizeProp ((:||) Condition Type) 
SizeProp ((:||) COMPLEX Type) 
SizeProp ((:||) ORD Type) 
SizeProp ((:||) EQ Type) 
SizeProp ((:||) Logic Type) 
SizeProp ((:||) BITS Type) 
SizeProp ((:||) INTEGRAL Type) 
SizeProp ((:||) Error Type) 
SizeProp ((:||) FLOATING Type) 
SizeProp ((:||) NUM Type) 
SizeProp ((:||) FRACTIONAL Type) 
SizeProp ((:||) NoInline Type) 
SizeProp ((:||) REALFLOAT Type) 
SizeProp ((:||) Trace Type) 
SizeProp ((:||) FFI Type) 
SizeProp ((:||) Save Type) 
SizeProp ((:||) Array Type) 
SizeProp ((:||) FUTURE Type) 
SizeProp ((:||) Switch Type) 
SizeProp ((:||) Conversion Type) 
SizeProp ((:||) Loop Type) 
SizeProp ((:||) PropSize Type) 
((:<:) ((:||) Variable Type) dom, OptimizeSuper dom) => Optimize ((:||) Variable Type) dom 
((:<:) ((:||) Select Type) dom, (:<:) (CLambda Type) dom, (:<:) ((:||) Tuple Type) dom, (:<:) Let dom, (:<:) ((:||) Variable Type) dom, OptimizeSuper dom) => Optimize ((:||) Select Type) dom 
((:<:) ((:||) Tuple Type) dom, (:<:) ((:||) Select Type) dom, OptimizeSuper dom) => Optimize ((:||) Tuple Type) dom 
((:<:) ((:||) Literal Type) dom, OptimizeSuper dom) => Optimize ((:||) Literal Type) dom 
((:<:) ((:||) (Decor SourceInfo1 Identity) Type) dom, Optimize dom dom) => Optimize ((:||) (Decor SourceInfo1 Identity) Type) dom 
((:<:) ((:||) Condition Type) dom, (:<:) ((:||) Logic Type) dom, (:<:) ((:||) EQ Type) dom, (:<:) ((:||) ORD Type) dom, (:<:) ((:||) Variable Type) dom, (:<:) (CLambda Type) dom, Monotonic dom, OptimizeSuper dom) => Optimize ((:||) Condition Type) dom 
((:<:) ((:||) COMPLEX Type) dom, OptimizeSuper dom) => Optimize ((:||) COMPLEX Type) dom 
((:<:) ((:||) ORD Type) dom, Monotonic dom, OptimizeSuper dom) => Optimize ((:||) ORD Type) dom 
((:<:) ((:||) EQ Type) dom, OptimizeSuper dom) => Optimize ((:||) EQ Type) dom 
((:<:) ((:||) Logic Type) dom, (:<:) ((:||) EQ Type) dom, (:<:) ((:||) ORD Type) dom, Monotonic dom, OptimizeSuper dom) => Optimize ((:||) Logic Type) dom 
((:<:) ((:||) BITS Type) dom, (:<:) ((:||) Logic Type) dom, (:<:) ((:||) EQ Type) dom, (:<:) ((:||) ORD Type) dom, Monotonic dom, OptimizeSuper dom) => Optimize ((:||) BITS Type) dom 
((:<:) ((:||) INTEGRAL Type) dom, (:<:) ((:||) BITS Type) dom, (:<:) ((:||) EQ Type) dom, (:<:) ((:||) ORD Type) dom, (:<:) ((:||) COMPLEX Type) dom, (:<:) ((:||) Condition Type) dom, (:<:) ((:||) Logic Type) dom, Monotonic dom, OptimizeSuper dom, Optimize ((:||) Condition Type) dom) => Optimize ((:||) INTEGRAL Type) dom 
((:<:) ((:||) Error Type) dom, Optimize dom dom) => Optimize ((:||) Error Type) dom 
((:<:) ((:||) FLOATING Type) dom, OptimizeSuper dom) => Optimize ((:||) FLOATING Type) dom 
((:<:) ((:||) NUM Type) dom, (:<:) ((:||) Literal Type) dom, (:<:) ((:||) INTEGRAL Type) dom, (:<:) ((:||) COMPLEX Type) dom, OptimizeSuper dom) => Optimize ((:||) NUM Type) dom 
((:<:) ((:||) FRACTIONAL Type) dom, (:<:) ((:||) NUM Type) dom, OptimizeSuper dom) => Optimize ((:||) FRACTIONAL Type) dom 
((:<:) ((:||) NoInline Type) dom, OptimizeSuper dom) => Optimize ((:||) NoInline Type) dom 
((:<:) ((:||) REALFLOAT Type) dom, OptimizeSuper dom) => Optimize ((:||) REALFLOAT Type) dom 
((:<:) ((:||) Trace Type) dom, OptimizeSuper dom) => Optimize ((:||) Trace Type) dom 
((:<:) ((:||) FFI Type) dom, OptimizeSuper dom) => Optimize ((:||) FFI Type) dom 
((:<:) ((:||) Save Type) dom, OptimizeSuper dom) => Optimize ((:||) Save Type) dom 
((:<:) ((:||) Array Type) dom, (:<:) ((:||) NUM Type) dom, (:<:) Let dom, (:<:) ((:||) ORD Type) dom, (:<:) ((:||) INTEGRAL Type) dom, (:<:) ((:||) COMPLEX Type) dom, (:<:) ((:||) Variable Type) dom, (:<:) (CLambda Type) dom, OptimizeSuper dom) => Optimize ((:||) Array Type) dom 
((:<:) ((:||) FUTURE Type) dom, OptimizeSuper dom) => Optimize ((:||) FUTURE Type) dom 
((:<:) ((:||) Switch Type) dom, (:<:) ((:||) EQ Type) dom, (:<:) ((:||) Condition Type) dom, OptimizeSuper dom) => Optimize ((:||) Switch Type) dom 
((:<:) ((:||) Conversion Type) dom, OptimizeSuper dom) => Optimize ((:||) Conversion Type) dom 
((:<:) ((:||) Literal Type) dom, (:<:) ((:||) Loop Type) dom, (:<:) ((:||) Variable Type) dom, (:<:) (CLambda Type) dom, (:<:) Let dom, OptimizeSuper dom) => Optimize ((:||) Loop Type) dom 
((:<:) ((:||) PropSize Type) dom, OptimizeSuper dom) => Optimize ((:||) PropSize Type) dom 
(Type a, Type b, Type c) => Type (a, b, c) 
(Type a, Type b, Type c, Type d) => Type (a, b, c, d) 
Typed (SubConstr2 c sub Type Top) 
(Type a, Type b, Type c, Type d, Type e) => Type (a, b, c, d, e) 
(Type a, Type b, Type c, Type d, Type e, Type f) => Type (a, b, c, d, e, f) 
(Type a, Type b, Type c, Type d, Type e, Type f, Type g) => Type (a, b, c, d, e, f, g) 

Sized types

type family Size a Source

Instances

type Size Bool = AnySize 
type Size Double = AnySize 
type Size Float = AnySize 
type Size Int8 = Range Int8 
type Size Int16 = Range Int16 
type Size Int32 = Range Int32 
type Size Int64 = Range Int64 
type Size Word8 = Range Word8 
type Size Word16 = Range Word16 
type Size Word32 = Range Word32 
type Size Word64 = Range Word64 
type Size () = AnySize 
type Size IntN = Range IntN 
type Size WordN = Range WordN 
type Size [a] = (:>) (Range Length) (Size a) 
type Size (Complex a) = AnySize 
type Size (IORef a) = Size a 
type Size (FVal a) = Size a 
type Size (IV a) = Size a 
type Size (Par a) = Size a 
type Size (MArr a) = (:>) (Range Length) (Size a) 
type Size (Mut a) = Size a 
type Size (a -> b) = (Size a, Size b) 
type Size (a, b) = (Size a, Size b) 
type Size (TargetArr n a) = (:>) (Range (GenericInt U n)) (Size a) 
type Size (a, b, c) = (Size a, Size b, Size c) 
type Size (a, b, c, d) = (Size a, Size b, Size c, Size d) 
type Size (a, b, c, d, e) = (Size a, Size b, Size c, Size d, Size e) 
type Size (a, b, c, d, e, f) = (Size a, Size b, Size c, Size d, Size e, Size f) 
type Size (a, b, c, d, e, f, g) = (Size a, Size b, Size c, Size d, Size e, Size f, Size g) 

data RangeSet a where Source

A generalization of Range that serves two purposes: (1) Adding an extra Universal constructor to support unbounded types (Range can only represent bounded ranges), and (2) pack a BoundedInt constraint with the RangeSet constructor. This is what allows sizeToRange to be defined as a total function with Type as the only constraint.

Constructors

RangeSet :: BoundedInt a => Range a -> RangeSet a 
Universal :: RangeSet a 

Instances

Show a => Show (RangeSet a) 

sizeToRange :: forall a. Type a => Size a -> RangeSet a Source

Cast a Size to a RangeSet

tArr :: Patch a a -> Patch [a] [a] Source