Defines types and classes for the data computed by Feldspar programs.
- data T a = T
- numberT :: forall n. IntegerT n => T n -> Int
- class HaskellType a where
- class HaskellValue a where
- class NaturalT n => GetTuple n a where
- data Tuple a
- showTuple :: Tuple String -> String
- tuplePath :: Tuple a -> Tuple [Int]
- data PrimitiveType
- data PrimitiveData
- data StorableType = StorableType [Int] PrimitiveType
- data StorableData
- class Storable a => Primitive a
- data n :> a = (NaturalT n, Storable a) => ArrayList [a]
- mapArray :: (NaturalT n, Storable a, Storable b) => (a -> b) -> (n :> a) -> n :> b
- class Typeable a => Storable a where
- isRectangular :: Storable a => a -> Bool
- class (Eq a, Ord a) => Typeable a where
- isPrimitive :: Typeable a => T a -> Bool
Types as arguments
Haskell source code
Types that can represent Haskell types (as source code strings)
Types that can represent Haskell values (as source code strings)
General tuple projection
Untyped representation of nested tuples
Shows a nested tuple in Haskell's tuple syntax (e.g
Replaces each element by its path in the tuple tree. For example:
tuplePath (Tup [One 'a',Tup [One 'b', One 'c']]) == Tup [One ,Tup [One [1,0],One [1,1]]]
Representation of primitive types
Untyped representation of primitive data
Representation of storable types (arrays of primitive data). Array dimensions are given as a list of integers, starting with outermost array level. Primitive types are treated as zero-dimensional arrays.
Untyped representation of storable data. Arrays have a length argument that gives the number of elements on the outermost array level. If the data list is shorter than this length, the missing elements are taken to have undefined value. If the data list is longer, the excessive elements are just ignored.
Array represented as (nested) list. If
a is a storable type and
n is a
type-level natural number,
n :> a represents an array of
n elements of
a. For example,
D3:>D10:>Int is a 3 by 10 array of integers. Arrays
fromList are guaranteed not to contain too many elements
in any dimension. If there are too few elements in any dimension, the missing
ones are taken to have undefined value.
|(NaturalT n, Storable a) => RandomAccess (Data (:> n a))|
|(NaturalT n, Storable a, Eq a) => Eq (:> n a)|
|(NaturalT n, Storable a, Ord a) => Ord (:> n a)|
|(NaturalT n, Storable a, Show (ListBased a)) => Show (:> n a)|
|(NaturalT n, Storable a) => Typeable (:> n a)|
|(NaturalT n, Storable a) => Storable (:> n a)|
*Feldspar.Core.Types> toList (replicateArray 3 :: D4 :> D2 :> Int) [[3,3],[3,3],[3,3],[3,3]]
List-based representation of a storable type
The innermost element of a storable type
Constructs an array filled with the given element. For primitive types, this is just the identity function.
Converts a storable type to a (zero- or higher-level) nested list.
Constructs a storable type from a (zero- or higher-level) nested list. The resulting value is guaranteed not to have too many elements in any dimension. Excessive elements are simply cut away.
Converts a storable value to its untyped representation.
All supported types of data (nested tuples of storable data)