Defines types and classes for the data computed by Feldspar programs.
- data T a = T
- mkT :: a -> T a
- data a :> b = a :> b
- class Set a where
- universal :: a
- type Length = Int
- data Tuple a
- showTuple :: Tuple String -> String
- tuplePath :: Tuple a -> Tuple [Int]
- data PrimitiveData
- data StorableData
- type Unsigned32 = Word32
- type Signed32 = Int32
- type Unsigned16 = Word16
- type Signed16 = Int16
- type Unsigned8 = Word8
- type Signed8 = Int8
- data PrimitiveType
- data StorableType = StorableType [Range Length] PrimitiveType
- showPrimitiveRange :: PrimitiveType -> String
- showStorableSize :: StorableType -> String
- class Storable a => Primitive a
- class Typeable a => Storable a where
- storableData :: a -> StorableData
- storableType :: Size a -> T a -> StorableType
- storableSize :: a -> Size a
- listSize :: T a -> Size a -> [Range Length]
- class (Eq a, Monoid (Size a), Set (Size a)) => Typeable a where
- typeOfStorable :: Storable a => Size a -> T a -> Tuple StorableType
Misc.
Heterogeneous list
a :> b |
Tuples
Untyped representation of nested tuples
Functor Tuple | |
Foldable Tuple | |
Traversable Tuple | |
Eq a => Eq (Tuple a) | |
Show a => Show (Tuple a) | |
HaskellValue a => HaskellValue (Tuple a) | |
HaskellType a => HaskellType (Tuple a) |
showTuple :: Tuple String -> StringSource
Shows a nested tuple in Haskell's tuple syntax (e.g "(a,(b,c))"
).
tuplePath :: Tuple a -> Tuple [Int]Source
Replaces each element by its path in the tuple tree. For example:
tuplePath (Tup [One 'a',Tup [One 'b', One 'c']]) == Tup [One [0],Tup [One [1,0],One [1,1]]]
Data
data PrimitiveData Source
Untyped representation of primitive data
data StorableData Source
Untyped representation of storable data (arrays of primitive data)
Types
type Unsigned32 = Word32Source
type Unsigned16 = Word16Source
data PrimitiveType Source
Representation of primitive types
data StorableType Source
Representation of storable types (arrays of primitive types). Array size is given as a list of ranged lengths, starting with outermost array level. Primitive types are treated as zero-dimensional arrays.
showStorableSize :: StorableType -> StringSource
Shows the size of a storable type.
class Typeable a => Storable a whereSource
Storable types (zero- or higher-level arrays of primitive data).
storableData :: a -> StorableDataSource
Converts a storable value to its untyped representation.
storableType :: Size a -> T a -> StorableTypeSource
Gives the type representation of a storable value.
storableSize :: a -> Size aSource
Gives the size of a storable value.
class (Eq a, Monoid (Size a), Set (Size a)) => Typeable a whereSource
This type provides the necessary extra information to compute a type
representation
from a type Tuple
StorableType
a
. This is needed
because the type a
is missing information about sizes of arrays and
primitive values.
typeOf :: Size a -> T a -> Tuple StorableTypeSource
Gives the type representation of a storable value.
Typeable Bool | |
Typeable Float | |
Typeable Int | |
Typeable () | |
Typeable Signed8 | |
Typeable Unsigned8 | |
Typeable Signed16 | |
Typeable Unsigned16 | |
Typeable Signed32 | |
Typeable Unsigned32 | |
Storable a => Typeable [a] | |
(Typeable a, Typeable b) => Typeable (a, b) | |
(Typeable a, Typeable b, Typeable c) => Typeable (a, b, c) | |
(Typeable a, Typeable b, Typeable c, Typeable d) => Typeable (a, b, c, d) |
typeOfStorable :: Storable a => Size a -> T a -> Tuple StorableTypeSource