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

Safe HaskellSafe

Control.Monad.MultiPass.Instrument.Knot3

Description

The Knot3 instrument is used for knot tying across passes. Knot tying is a technique sometimes used in lazy functional programming, in which the definition of a variable depends on its own value. The lazy programming technique depends on an implicit two-pass ordering of the computation. For example, the classic repmin program produces a pair of outputs - a tree and an integer - and there is an implicit two-pass ordering where the integer is computed during the first pass and the tree during the second. The Knot3 instrument allows the same technique to be applied, but the ordering of the passes is managed explicitly by the Control.Monad.MultiPass library, rather than implicitly by lazy evalution.

Synopsis

Documentation

data Knot3 a r w p1 p2 p3 tc Source

Abstract datatype for the instrument.

Instances

Instrument tc () () (Knot3 a r w Off Off Off tc) 
Instrument tc (CounterTC1 Int r) () (Knot3 a r w On Off Off tc) 

knot3 :: (Monad p1, Monad p2, Monad p3) => Knot3 a r w p1 p2 p3 tc -> (p3 a -> MultiPass r w tc (p2 a, b)) -> MultiPass r w tc bSource

Tie the knot for the supplied function.