projects
/
haskell-directory.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Make Control.Exception buildable by nhc98.
[haskell-directory.git]
/
Control
/
Monad
/
Fix.hs
diff --git
a/Control/Monad/Fix.hs
b/Control/Monad/Fix.hs
index
c2b1669
..
ea481d8
100644
(file)
--- a/
Control/Monad/Fix.hs
+++ b/
Control/Monad/Fix.hs
@@
-24,11
+24,8
@@
module Control.Monad.Fix (
import Prelude
import System.IO
import Prelude
import System.IO
-
--- | @'fix' f@ is the least fixed point of the function @f@,
--- i.e. the least defined @x@ such that @f x = x@.
-fix :: (a -> a) -> a
-fix f = let x = f x in x
+import Control.Monad.Instances ()
+import Data.Function (fix)
-- | Monads having fixed points with a \'knot-tying\' semantics.
-- Instances of 'MonadFix' should satisfy the following laws:
-- | Monads having fixed points with a \'knot-tying\' semantics.
-- Instances of 'MonadFix' should satisfy the following laws:
@@
-37,7
+34,7
@@
fix f = let x = f x in x
-- @'mfix' ('return' . h) = 'return' ('fix' h)@
--
-- [/left shrinking/ (or /tightening/)]
-- @'mfix' ('return' . h) = 'return' ('fix' h)@
--
-- [/left shrinking/ (or /tightening/)]
--- @'mfix' (\\x -> a >>= \\y -> f x y) = \\y -> 'mfix' (\\x -> f x y)@
+-- @'mfix' (\\x -> a >>= \\y -> f x y) = a >>= \\y -> 'mfix' (\\x -> f x y)@
--
-- [/sliding/]
-- @'mfix' ('Control.Monad.liftM' h . f) = 'Control.Monad.liftM' h ('mfix' (f . h))@,
--
-- [/sliding/]
-- @'mfix' ('Control.Monad.liftM' h . f) = 'Control.Monad.liftM' h ('mfix' (f . h))@,
@@
-71,3
+68,6
@@
instance MonadFix [] where
-- IO:
instance MonadFix IO where
mfix = fixIO
-- IO:
instance MonadFix IO where
mfix = fixIO
+
+instance MonadFix ((->) r) where
+ mfix f = \ r -> let a = f a r in a