Safe Haskell | Safe |
---|
The EmitST2Array
instrument is used to emit a sequence of values to
an ST2Array
. It has three passes. The first pass counts the number
of elements that will be written. The second pass is optional: it
enables the index values to be read before the actual values have been
written. (If this pass is not needed then the second and third passes
can be merged by coalescing the type variables for the second and
third passes: EmitST2Array p1 p2 p2
.) The third pass writes the
values to the output array.
- data EmitST2Array i a r w p1 p2 p3 tc
- setBaseIndex :: (Ix i, Num i, Monad p1, Monad p2, Monad p3) => EmitST2Array i a r w p1 p2 p3 tc -> p2 i -> MultiPassPrologue r w tc ()
- emit :: (Ix i, Num i, Monad p1, Monad p2, Monad p3) => EmitST2Array i a r w p1 p2 p3 tc -> p3 a -> MultiPass r w tc ()
- emitList :: (Ix i, Num i, Monad p1, Monad p2, Monad p3) => EmitST2Array i a r w p1 p2 p3 tc -> p1 Int -> p3 [a] -> MultiPass r w tc ()
- getIndex :: (Ix i, Num i, Monad p1, Monad p2, Monad p3) => EmitST2Array i a r w p1 p2 p3 tc -> MultiPass r w' tc (p2 i)
- getResult :: (Ix i, Num i, Monad p1, Monad p2, Monad p3) => EmitST2Array i a r w p1 p2 p3 tc -> MultiPassEpilogue r w tc (p3 (ST2Array r w i a))
Documentation
data EmitST2Array i a r w p1 p2 p3 tc Source
Abstract datatype for the instrument.
Instrument tc () () (EmitST2Array i a r w Off Off Off tc) | |
Num i => Instrument tc (CounterTC1 i r) () (EmitST2Array i a r w On Off Off tc) |
:: (Ix i, Num i, Monad p1, Monad p2, Monad p3) | |
=> EmitST2Array i a r w p1 p2 p3 tc | Instrument |
-> p2 i | Base index |
-> MultiPassPrologue r w tc () |
Initialise the base index of the output array. This method is optional: if it is not called then the base index defaults to zero.
:: (Ix i, Num i, Monad p1, Monad p2, Monad p3) | |
=> EmitST2Array i a r w p1 p2 p3 tc | Instrument |
-> p3 a | Value to emit |
-> MultiPass r w tc () |
Write one element to the output array.
:: (Ix i, Num i, Monad p1, Monad p2, Monad p3) | |
=> EmitST2Array i a r w p1 p2 p3 tc | Instrument |
-> p1 Int | Length of the list |
-> p3 [a] | List of elements to emit |
-> MultiPass r w tc () |
Write a list of elements to the output array. The length of the list needs to be declared in the first pass so that the correct number of elements can be allocated.
:: (Ix i, Num i, Monad p1, Monad p2, Monad p3) | |
=> EmitST2Array i a r w p1 p2 p3 tc | Instrument |
-> MultiPass r w' tc (p2 i) | Current index |
Get the current index in the output array.
:: (Ix i, Num i, Monad p1, Monad p2, Monad p3) | |
=> EmitST2Array i a r w p1 p2 p3 tc | Instrument |
-> MultiPassEpilogue r w tc (p3 (ST2Array r w i a)) | Output array |
Get the output array.