1 -----------------------------------------------------------------------------
3 -- Module : Control.Monad.Fix
4 -- Copyright : (c) Andy Gill 2001,
5 -- (c) Oregon Graduate Institute of Science and Technology, 2001
6 -- License : BSD-style (see the file libraries/core/LICENSE)
8 -- Maintainer : libraries@haskell.org
9 -- Stability : experimental
10 -- Portability : portable
14 -- Inspired by the paper:
15 -- \em{Functional Programming with Overloading and
16 -- Higher-Order Polymorphism},
17 -- \A[HREF="http://www.cse.ogi.edu/~mpj"]{Mark P Jones},
18 -- Advanced School of Functional Programming, 1995.}
20 -----------------------------------------------------------------------------
22 module Control.Monad.Fix (
24 mfix -- :: (a -> m a) -> m a
26 fix -- :: (a -> a) -> a
33 fix f = let x = f x in x
35 class (Monad m) => MonadFix m where
36 mfix :: (a -> m a) -> m a
38 instance MonadFix Maybe where
42 _ -> error "empty mfix argument"
45 instance MonadFix IO where