Control-Monad-MultiPass- A Library for Writing Multi-Pass Algorithms.

Safe HaskellSafe



The DelayedLift instrument is stateless and provides a similar interface to readOnlyST2ToMP. The difference is that it only executes the read-only computation once the specified pass is reached.



data DelayedLift r w p1 tc Source

Abstract datatype for the instrument.


Instrument tc () () (DelayedLift r w On tc) 
Instrument tc () () (DelayedLift r w Off tc) 

delayedLift :: Monad p1 => DelayedLift r w p1 tc -> p1 (ReadOnlyST2 r a) -> MultiPass r w tc (p1 a)Source

Execute the read-only computation during pass p1.

readST2ArrayMP :: (Ix i, Monad p1) => DelayedLift r w p1 tc -> p1 (ST2Array r w i a) -> i -> MultiPass r w tc (p1 a)Source

readST2ArrayMP is a simple application of delayedLift. It reads an index of the array during pass p1. This is particularly useful if the array does not exist in earlier passes, for example because it was created by the CreateST2Array instrument.