X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;f=Control%2FMonad%2FST.hs;h=6d19b9c95f323a109744471ffd6dc68f6e3dc55e;hb=9fa9bc17072a58c0bae2cce4764d38677e96ac29;hp=7817add5362cdc80970f5f2c3f73185ef40e2ed7;hpb=77af63d30b55fd40254d0674feff81b01bc85585;p=ghc-base.git diff --git a/Control/Monad/ST.hs b/Control/Monad/ST.hs index 7817add..6d19b9c 100644 --- a/Control/Monad/ST.hs +++ b/Control/Monad/ST.hs @@ -1,14 +1,14 @@ ----------------------------------------------------------------------------- --- +-- | -- Module : Control.Monad.ST -- Copyright : (c) The University of Glasgow 2001 -- License : BSD-style (see the file libraries/core/LICENSE) -- -- 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.6 2002/04/24 16:31:38 simonmar Exp $ -- -- The State Transformer Monad, ST -- @@ -29,17 +29,24 @@ module Control.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