move fix to Data.Function
authorRoss Paterson <ross@soi.city.ac.uk>
Fri, 10 Nov 2006 14:11:20 +0000 (14:11 +0000)
committerRoss Paterson <ross@soi.city.ac.uk>
Fri, 10 Nov 2006 14:11:20 +0000 (14:11 +0000)
Control/Monad/Fix.hs
Data/Function.hs

index e04a7f6..ea481d8 100644 (file)
@@ -25,11 +25,7 @@ module Control.Monad.Fix (
 import Prelude
 import System.IO
 import Control.Monad.Instances ()
-
--- | @'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 Data.Function (fix)
 
 -- | Monads having fixed points with a \'knot-tying\' semantics.
 -- Instances of 'MonadFix' should satisfy the following laws:
index 1de5eac..bc851a0 100644 (file)
@@ -14,6 +14,7 @@ module Data.Function
   ( -- * "Prelude" re-exports
     id, const, (.), flip, ($)
     -- * Other combinators
+  , fix
   , on
   ) where
 
@@ -21,6 +22,11 @@ import Prelude
 
 infixl 0 `on`
 
+-- | @'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
+
 -- | @(*) \`on\` f = \\x y -> f x * f y@.
 --
 -- Typical usage: @'Data.List.sortBy' ('compare' \`on\` 'fst')@.