Safe Haskell | Safe |
---|
The EmitST2ArrayFxp
instrument has an identical interface to
EmitST2Array
. The only difference
is that EmitST2ArrayFxp
includes support for back-tracking. The
emitList
method of EmitST2ArrayFxp
permits the list argument to be
longer than the lower bound which was specified during the first
pass. If it is then the algorithm will back-track to the beginning of
the second pass and iterate until a fixed point has been reached.
- data EmitST2ArrayFxp i a r w p1 p2 p3 tc
- setBaseIndex :: (Ix i, Num i, Monad p1, Monad p2, Monad p3) => EmitST2ArrayFxp 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) => EmitST2ArrayFxp 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) => EmitST2ArrayFxp 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) => EmitST2ArrayFxp 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) => EmitST2ArrayFxp i a r w p1 p2 p3 tc -> MultiPassEpilogue r w tc (p3 (ST2Array r w i a))
Documentation
data EmitST2ArrayFxp i a r w p1 p2 p3 tc Source
Abstract datatype for the instrument.
Instrument tc () () (EmitST2ArrayFxp i a r w Off Off Off tc) |
:: (Ix i, Num i, Monad p1, Monad p2, Monad p3) | |
=> EmitST2ArrayFxp 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) | |
=> EmitST2ArrayFxp 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) | |
=> EmitST2ArrayFxp 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 instrument uses back-tracking to iterate until the length of the list has been determined. It is the client's responsibility to ensure that any operations which depend on the length of the list are monotonic so that a fixed point will be found. The first argument is used to supply a minimum length for the list (zero is always a valid input). It can be used to shorten the time to convergence when a good lower bound is known.
:: (Ix i, Num i, Monad p1, Monad p2, Monad p3) | |
=> EmitST2ArrayFxp 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) | |
=> EmitST2ArrayFxp 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.