From: ross Date: Tue, 1 Oct 2002 16:29:47 +0000 (+0000) Subject: [project @ 2002-10-01 16:29:47 by ross] X-Git-Tag: nhc98-1-18-release~830 X-Git-Url: http://git.megacz.com/?a=commitdiff_plain;h=40c9fe1edc154b17c380408f10f5991663735dd2;p=ghc-base.git [project @ 2002-10-01 16:29:47 by ross] 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. --- diff --git a/Control/Monad/Fix.hs b/Control/Monad/Fix.hs index c465511..6c9ac7f 100644 --- a/Control/Monad/Fix.hs +++ b/Control/Monad/Fix.hs @@ -17,8 +17,6 @@ -- Mark P Jones () -- 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 diff --git a/Control/Monad/ST/Lazy.hs b/Control/Monad/ST/Lazy.hs index 085075b..ffbb1af 100644 --- a/Control/Monad/ST/Lazy.hs +++ b/Control/Monad/ST/Lazy.hs @@ -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