diff options
Diffstat (limited to 'libraries/base/Control/Monad/ST/Lazy/Imp.hs')
-rw-r--r-- | libraries/base/Control/Monad/ST/Lazy/Imp.hs | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/libraries/base/Control/Monad/ST/Lazy/Imp.hs b/libraries/base/Control/Monad/ST/Lazy/Imp.hs index 5bb1a06caf..625bcb0fe3 100644 --- a/libraries/base/Control/Monad/ST/Lazy/Imp.hs +++ b/libraries/base/Control/Monad/ST/Lazy/Imp.hs @@ -8,7 +8,7 @@ -- Module : Control.Monad.ST.Lazy.Imp -- Copyright : (c) The University of Glasgow 2001 -- License : BSD-style (see the file libraries/base/LICENSE) --- +-- -- Maintainer : libraries@haskell.org -- Stability : provisional -- Portability : non-portable (requires universal quantification for runST) @@ -44,7 +44,6 @@ import qualified Control.Monad.ST.Unsafe as ST import qualified GHC.ST as GHC.ST import GHC.Base -import qualified Control.Monad.Fail as Fail -- | The lazy @'ST' monad. -- The ST monad allows for destructive updates, but is escapable (unlike IO). @@ -192,7 +191,7 @@ instance Monad (ST s) where unST (k r) new_s -- | @since 4.10 -instance Fail.MonadFail (ST s) where +instance MonadFail (ST s) where fail s = errorWithoutStackTrace s -- | Return the value computed by an 'ST' computation. @@ -205,8 +204,8 @@ runST (ST st) = runRW# (\s -> case st (S# s) of (r, _) -> r) -- inside the computation. -- Note that if @f@ is strict, @'fixST' f = _|_@. fixST :: (a -> ST s a) -> ST s a -fixST m = ST (\ s -> - let +fixST m = ST (\ s -> + let q@(r,_s') = unST (m r) s in q) -- Why don't we need unsafePerformIO in fixST? We create a thunk, q, @@ -233,7 +232,7 @@ strictToLazyST (GHC.ST.ST m) = ST $ \(S# s) -> (# s', a #) -> (a, S# s') -- See Note [Lazy ST: not producing lazy pairs] -{-| +{-| Convert a lazy 'ST' computation into a strict one. -} lazyToStrictST :: ST s a -> ST.ST s a |