Safe Haskell | Safe |
---|
The Monoid2
instrument is used to accumulate a global value during
the first pass. During the second pass, the global value can be read
but not written. The value must be an instance of the
Monoid
class. The names of the methods, tell
and
listen
, are taken from the MonadWriter
class. If this causes a naming conflict, then this module should be
imported qualified. For example:
import qualified Control.Monad.MultiPass.Instrument.Monoid2 as M
- data Monoid2 a r w p1 p2 tc
- tell :: (Monoid a, Monad p1, Monad p2) => Monoid2 a r w p1 p2 tc -> p1 a -> MultiPass r w tc ()
- listen :: (Monoid a, Monad p1, Monad p2) => Monoid2 a r w p1 p2 tc -> MultiPass r w tc (p2 a)
- tellPrologue :: (Monoid a, Monad p1, Monad p2) => Monoid2 a r w p1 p2 tc -> p1 a -> MultiPassPrologue r w tc ()
- listenEpilogue :: (Monoid a, Monad p1, Monad p2) => Monoid2 a r w p1 p2 tc -> MultiPassEpilogue r w tc (p1 a)
Documentation
data Monoid2 a r w p1 p2 tc Source
Abstract datatype for the instrument.
Instrument tc () () (Monoid2 a r w Off Off tc) | |
Monoid a => Instrument tc (MonoidTC a) () (Monoid2 a r w On Off tc) |
:: (Monoid a, Monad p1, Monad p2) | |
=> Monoid2 a r w p1 p2 tc | Instrument |
-> p1 a | Value to add |
-> MultiPass r w tc () |
Add a value to the global value, during the first pass.
:: (Monoid a, Monad p1, Monad p2) | |
=> Monoid2 a r w p1 p2 tc | Instrument |
-> MultiPass r w tc (p2 a) | Global value |
Read the global value, during the second pass.
:: (Monoid a, Monad p1, Monad p2) | |
=> Monoid2 a r w p1 p2 tc | Instrument |
-> p1 a | Value to add |
-> MultiPassPrologue r w tc () |
Add a value to the global value, during the prologue of the first pass.
:: (Monoid a, Monad p1, Monad p2) | |
=> Monoid2 a r w p1 p2 tc | Instrument |
-> MultiPassEpilogue r w tc (p1 a) | Global value |
Read the global value, during the epilogue of the first pass.