accelerate- An embedded language for accelerated array processing

Portabilitynon-portable (GHC extensions)
MaintainerManuel M T Chakravarty <>
Safe HaskellNone




Our representation of tuples are heterogenous snoc lists, which are typed by type lists, where '()' and '(,)' are type-level nil and snoc, respectively. The components may only be drawn from types that can be used as array elements.


Tuple representation

data Tuple c t whereSource

We represent tuples as heterogenous lists, typed by a type list.


NilTup :: Tuple c () 
SnocTup :: Elt t => Tuple c s -> c t -> Tuple c (s, t) 

data TupleIdx t e whereSource

Type-safe projection indicies for tuples.

NB: We index tuples by starting to count from the *right*!


ZeroTupIdx :: Elt s => TupleIdx (t, s) s 
SuccTupIdx :: TupleIdx t e -> TupleIdx (t, s) e 

class IsTuple tup whereSource

Conversion between surface n-tuples and our tuple representation.

Associated Types

type TupleRepr tup Source


fromTuple :: tup -> TupleRepr tupSource

toTuple :: TupleRepr tup -> tupSource


IsTuple () 
IsTuple (a, b) 
IsTuple (a, b, c) 
IsTuple (a, b, c, d) 
IsTuple (a, b, c, d, e) 
IsTuple (a, b, c, d, e, f) 
IsTuple (a, b, c, d, e, f, g) 
IsTuple (a, b, c, d, e, f, g, h) 
IsTuple (a, b, c, d, e, f, g, h, i)