Description
Monadic fixpoints.
For a detailed discussion, see Levent Erkok's thesis, Value Recursion in Monadic Computations, Oregon Graduate Institute, 2002.
Documentationclass Monad m => MonadFix m whereSource
Monads having fixed points with a 'knot-tying' semantics. Instances of MonadFix
should satisfy the following laws:
mfix
(return
. h) = return
(fix
h)
mfix
(\x -> a >>= \y -> f x y) = a >>= \y -> mfix
(\x -> f x y)
mfix
(liftM
h . f) = liftM
h (mfix
(f . h))
, for strict h
.
mfix
(\x -> mfix
(\y -> f x y)) = mfix
(\x -> f x x)
This class is used in the translation of the recursive do
notation supported by GHC and Hugs.
Methods
mfix :: (a -> m a) -> m aSource
The fixed point of a monadic computation.
executes the action mfix
ff
only once, with the eventual output fed back as the input. Hence f
should not be strict, for then
would diverge.mfix
f
is the least fixed point of the function fix
ff
, i.e. the least defined x
such that f x = x
.
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4