 | bytestring-0.9.0.1.1: Fast, packed, strict and lazy byte arrays with a list interface | Contents | Index |
|
Data.ByteString.Fusion | Portability | portable | Stability | experimental | Maintainer | dons@cse.unsw.edu.au |
|
|
|
|
|
Description |
Functional array fusion for ByteStrings.
Originally based on code from the Data Parallel Haskell project,
http://www.cse.unsw.edu.au/~chak/project/dph
|
|
Synopsis |
|
|
|
|
Fusion utilities
|
|
loopU |
:: | | => AccEFL acc | mapping & folding, once per elem
| -> acc | initial acc value
| -> ByteString | input ByteString
| -> PairS acc ByteString | | Iteration over over ByteStrings
Iteration over over ByteStrings
|
|
|
loopL |
:: | | => AccEFL acc | mapping & folding, once per elem
| -> acc | initial acc value
| -> ByteString | input ByteString
| -> PairS acc ByteString | |
|
|
fuseEFL :: AccEFL acc1 -> AccEFL acc2 -> AccEFL (PairS acc1 acc2) |
Fuse to flat loop functions
|
|
data NoAcc |
Data type for accumulators which can be ignored. The rewrite rules rely on
the fact that no bottoms of this type are ever constructed; hence, we can
assume (_ :: NoAcc) seq x = x.
| Constructors | |
|
|
loopArr :: PairS acc arr -> arr |
Projection functions that are fusion friendly (as in, we determine when
they are inlined)
|
|
loopAcc :: PairS acc arr -> acc |
|
loopSndAcc :: PairS (PairS acc1 acc2) arr -> PairS acc2 arr |
|
unSP :: PairS acc arr -> (acc, arr) |
|
mapEFL :: (Word8 -> Word8) -> AccEFL NoAcc |
Special forms of loop arguments
- These are common special cases for the three function arguments of gen
and loop; we give them special names to make it easier to trigger RULES
applying in the special cases represented by these arguments. The
INLINE [1] makes sure that these functions are only inlined in the last
two simplifier phases.
- In the case where the accumulator is not needed, it is better to always
explicitly return a value `()', rather than just copy the input to the
output, as the former gives GHC better local information.
Element function expressing a mapping only
|
|
filterEFL :: (Word8 -> Bool) -> AccEFL NoAcc |
Element function implementing a filter function only
|
|
foldEFL :: (acc -> Word8 -> acc) -> AccEFL acc |
Element function expressing a reduction only
|
|
foldEFL' :: (acc -> Word8 -> acc) -> AccEFL acc |
A strict foldEFL.
|
|
scanEFL :: (Word8 -> Word8 -> Word8) -> AccEFL Word8 |
Element function expressing a prefix reduction only
|
|
mapAccumEFL :: (acc -> Word8 -> (acc, Word8)) -> AccEFL acc |
Element function implementing a map and fold
|
|
mapIndexEFL :: (Int -> Word8 -> Word8) -> AccEFL Int |
Element function implementing a map with index
|
|
Alternative Fusion stuff
|
|
This replaces loopU with loopUp
and adds several further special cases of loops.
|
|
loopUp :: AccEFL acc -> acc -> ByteString -> PairS acc ByteString |
|
loopDown :: AccEFL acc -> acc -> ByteString -> PairS acc ByteString |
|
loopNoAcc :: NoAccEFL -> ByteString -> PairS NoAcc ByteString |
|
loopMap :: MapEFL -> ByteString -> PairS NoAcc ByteString |
|
loopFilter :: FilterEFL -> ByteString -> PairS NoAcc ByteString |
|
loopWrapper :: ImperativeLoop acc -> ByteString -> PairS acc ByteString |
|
sequenceLoops :: ImperativeLoop acc1 -> ImperativeLoop acc2 -> ImperativeLoop (PairS acc1 acc2) |
|
doUpLoop :: AccEFL acc -> acc -> ImperativeLoop acc |
|
doDownLoop :: AccEFL acc -> acc -> ImperativeLoop acc |
|
doNoAccLoop :: NoAccEFL -> noAcc -> ImperativeLoop noAcc |
|
doMapLoop :: MapEFL -> noAcc -> ImperativeLoop noAcc |
|
doFilterLoop :: FilterEFL -> noAcc -> ImperativeLoop noAcc |
|
These are the special fusion cases for combining each loop form perfectly.
|
|
fuseAccAccEFL :: AccEFL acc1 -> AccEFL acc2 -> AccEFL (PairS acc1 acc2) |
|
fuseAccNoAccEFL :: AccEFL acc -> NoAccEFL -> AccEFL (PairS acc noAcc) |
|
fuseNoAccAccEFL :: NoAccEFL -> AccEFL acc -> AccEFL (PairS noAcc acc) |
|
fuseNoAccNoAccEFL :: NoAccEFL -> NoAccEFL -> NoAccEFL |
|
fuseMapAccEFL :: MapEFL -> AccEFL acc -> AccEFL (PairS noAcc acc) |
|
fuseAccMapEFL :: AccEFL acc -> MapEFL -> AccEFL (PairS acc noAcc) |
|
fuseMapNoAccEFL :: MapEFL -> NoAccEFL -> NoAccEFL |
|
fuseNoAccMapEFL :: NoAccEFL -> MapEFL -> NoAccEFL |
|
fuseMapMapEFL :: MapEFL -> MapEFL -> MapEFL |
|
fuseAccFilterEFL :: AccEFL acc -> FilterEFL -> AccEFL (PairS acc noAcc) |
|
fuseFilterAccEFL :: FilterEFL -> AccEFL acc -> AccEFL (PairS noAcc acc) |
|
fuseNoAccFilterEFL :: NoAccEFL -> FilterEFL -> NoAccEFL |
|
fuseFilterNoAccEFL :: FilterEFL -> NoAccEFL -> NoAccEFL |
|
fuseFilterFilterEFL :: FilterEFL -> FilterEFL -> FilterEFL |
|
fuseMapFilterEFL :: MapEFL -> FilterEFL -> NoAccEFL |
|
fuseFilterMapEFL :: FilterEFL -> MapEFL -> NoAccEFL |
|
Strict pairs and sums
|
|
data PairS a b |
Strict pair
| Constructors | | Instances | |
|
|
data MaybeS a |
Strict Maybe
| Constructors | | Instances | |
|
|
Produced by Haddock version 2.2.2 |