|
Control.Comonad.Context | Portability | portable | Stability | experimental | Maintainer | zednenem@psualum.com |
|
|
|
|
|
Description |
Defines the state-in-context comonad, which is dual to the state monad.
Each operation in the context comonad runs in a context determined
by later operations. (Observe, for example, experiment, which runs
the preceeding operations multiple times in different contexts and
returns a list of results.)
|
|
Synopsis |
|
|
|
Documentation |
|
data Context c a |
|
|
get :: Context c a -> c |
Returns the context |
|
modify :: (c -> c) -> Context c a -> a |
Returns the result of the preceeding operations running in
a modified context |
|
experiment :: [c -> c] -> Context c a -> [a] |
Returns a list of results created by running prior operations
in modified contexts created by the list of context-modifiers. |
|
liftCtx :: (a -> b) -> Context c a -> b |
Lifts an operation into the context comonad. Syntactic sugar
for fmap when chaining comonad operations.
liftCtx == extract . fmap f
w =>> liftCtx f == fmap f w
|
|
Produced by Haddock version 0.6 |