--
-- Maintainer : libraries@haskell.org
-- Stability : experimental
--- Portability : non-portable
+-- Portability : non-portable (requires universal quantification for runST)
--
--- $Id: ST.hs,v 1.2 2001/06/29 09:41:37 simonmar Exp $
+-- $Id: ST.hs,v 1.5 2001/12/21 15:07:21 simonmar Exp $
--
-- The State Transformer Monad, ST
--
import Prelude
+import Control.Monad.Fix
import Data.Dynamic
#ifdef __GLASGOW_HASKELL__
import GHC.ST
-import GHC.Prim ( unsafeCoerce#, RealWorld )
+import GHC.Base ( unsafeCoerce#, RealWorld )
import GHC.IOBase ( IO(..), stToIO )
+-- This relies on IO and ST having the same representation modulo the
+-- constraint on the type of the state
+--
unsafeIOToST :: IO a -> ST s a
unsafeIOToST (IO io) = ST $ \ s -> (unsafeCoerce# io) s
#endif
+instance MonadFix (ST s) where
+ mfix = fixST
+
-- ---------------------------------------------------------------------------
-- Typeable instance