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
12 -- $Id: Fix.hs,v 1.5 2002/04/24 16:31:38 simonmar Exp $
16 -- Inspired by the paper:
17 -- \em{Functional Programming with Overloading and
18 -- Higher-Order Polymorphism},
19 -- \A[HREF="http://www.cse.ogi.edu/~mpj"]{Mark P Jones},
20 -- Advanced School of Functional Programming, 1995.}
22 -----------------------------------------------------------------------------
24 module Control.Monad.Fix (
26 mfix -- :: (a -> m a) -> m a
28 fix -- :: (a -> a) -> a
35 fix f = let x = f x in x
37 class (Monad m) => MonadFix m where
38 mfix :: (a -> m a) -> m a
40 instance MonadFix Maybe where
44 _ -> error "empty mfix argument"
47 instance MonadFix IO where