[project @ 2002-10-01 16:29:47 by ross]
authorross <unknown>
Tue, 1 Oct 2002 16:29:47 +0000 (16:29 +0000)
committerross <unknown>
Tue, 1 Oct 2002 16:29:47 +0000 (16:29 +0000)
Removed the strict ST instance (already in Control.Monad.ST) and moved
the lazy ST instance to Control.Monad.ST.Lazy, so Control.Monad.Fix
contains only instances for Prelude types, and is portable.

Control/Monad/Fix.hs
Control/Monad/ST/Lazy.hs

index c465511..6c9ac7f 100644 (file)
@@ -17,8 +17,6 @@
 --         Mark P Jones (<http://www.cse.ogi.edu/~mpj>)
 --               Advanced School of Functional Programming, 1995.
 --
--- Oct. 1st, 2002: Added instances for Lazy ST, ST, and List monads
---           
 -----------------------------------------------------------------------------
 
 module Control.Monad.Fix (
@@ -29,8 +27,6 @@ module Control.Monad.Fix (
   ) where
 
 import Prelude
-import qualified Control.Monad.ST.Lazy as LazyST
-import qualified Control.Monad.ST as ST
 import System.IO
 
 fix :: (a -> a) -> a
@@ -39,7 +35,7 @@ fix f = let x = f x in x
 class (Monad m) => MonadFix m where
        mfix :: (a -> m a) -> m a
 
--- Instances of MonadFix
+-- Instances of MonadFix for Prelude monads
 
 -- Maybe:
 instance MonadFix Maybe where
@@ -55,11 +51,3 @@ instance MonadFix [] where
 -- IO:
 instance MonadFix IO where
     mfix = fixIO 
-
--- Lazy State:
-instance MonadFix (LazyST.ST s) where
-    mfix = LazyST.fixST
-    
--- Strict State:
-instance MonadFix (ST.ST s) where
-    mfix = ST.fixST
index 085075b..ffbb1af 100644 (file)
@@ -36,6 +36,8 @@ module Control.Monad.ST.Lazy (
 
 import Prelude
 
+import Control.Monad.Fix
+
 #ifdef __GLASGOW_HASKELL__
 import qualified Control.Monad.ST as ST
 import qualified GHC.ST
@@ -86,6 +88,9 @@ fixST m = ST (\ s ->
                   (r,s'))
 #endif
 
+instance MonadFix (ST s) where
+       mfix = fixST
+
 -- ---------------------------------------------------------------------------
 -- Strict <--> Lazy