-- 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 (
) 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
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
-- 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
import Prelude
+import Control.Monad.Fix
+
#ifdef __GLASGOW_HASKELL__
import qualified Control.Monad.ST as ST
import qualified GHC.ST
(r,s'))
#endif
+instance MonadFix (ST s) where
+ mfix = fixST
+
-- ---------------------------------------------------------------------------
-- Strict <--> Lazy