Safe Haskell | Safe |
---|---|
Language | Haskell98 |
An implementation of nested data parallelism (due to Simon Peyton Jones et al)
- data ArrC t
- newArray :: [e] -> Array Int e
- inject :: Array Int e -> ArrC e
- project :: ArrC t -> Array Int t
- data Structural a t u
- data A a t u
- unA :: Category * t => A t t1 t2 -> Structural t t1 t2
- mapA' :: ArrowChoice a => A a t u -> A a (ArrC t) (ArrC u)
- liftA :: Category a => a t u -> A a t u
- countA :: A a (t, Int) (ArrC (t, Int))
- indexA :: A a (ArrC u, Int) u
- zipA :: Category a => A a (ArrC t, ArrC u) (ArrC (t, u))
- unzipA :: Category a => A a (ArrC (t, u)) (ArrC t, ArrC u)
- concatA :: Category a => A a (ArrC (ArrC t)) (ArrC t)
- eval :: (ArrowChoice a, Strict a, Concurrent a) => Structural a t u -> a t u
- nQueens :: Int -> A (->) () (ArrC [Int])
- sorting :: Ord t => Int -> A (->) (ArrC t) (ArrC t)
- permute :: A (->) (ArrC Int) (ArrC Int)
Flattenable arrays
The arrows and associated operations
data Structural a t u Source
Category * a => Category * (Structural a) Source | |
Show (Structural a t u) Source |
The A
arrow includes a set of primitives that may be executed concurrently.
Programs are incrementally optimized as they are put together. A program may be
optimized once, and the result saved for repeated use.
Notes:
- The exact output of the optimizer is subject to change.
- The program must be a finite data structure, or optimization will diverge.
Category * a => Category * (A a) Source | |
ArrowChoice a => Arrow (A a) Source | |
ArrowChoice a => ArrowChoice (A a) Source | |
(Concurrent a, Strict a, ArrowChoice a, ArrowApply a) => ArrowApply (A a) Source |
unA :: Category * t => A t t1 t2 -> Structural t t1 t2 Source
Obtain a Structural
program from an A
program.
countA :: A a (t, Int) (ArrC (t, Int)) Source
Supplies an array of a repeated value paired with the index of each element.
eval :: (ArrowChoice a, Strict a, Concurrent a) => Structural a t u -> a t u Source
Evaluates arrows.
Notes:
- Effects are supported, but with much weaker semantics than the Kleisli arrows
of the monad. In particular, the
Map
and***
operations are allowed to be parallelized, but on the other hand parallelism is not guaranteed.