-% ------------------------------------------------------------------------------
-% $Id: ST.lhs,v 1.2 2001/12/21 15:07:25 simonmar Exp $
-%
-% (c) The University of Glasgow, 1992-2000
-%
-
-\section[GHC.ST]{The @ST@ monad}
-
\begin{code}
{-# OPTIONS -fno-implicit-prelude #-}
+-----------------------------------------------------------------------------
+-- |
+-- Module : GHC.ST
+-- Copyright : (c) The University of Glasgow, 1992-2002
+-- License : see libraries/base/LICENSE
+--
+-- Maintainer : cvs-ghc@haskell.org
+-- Stability : internal
+-- Portability : non-portable (GHC Extensions)
+--
+-- The 'ST' Monad.
+--
+-----------------------------------------------------------------------------
module GHC.ST where
{-# INLINE return #-}
{-# INLINE (>>) #-}
{-# INLINE (>>=) #-}
- return x = ST $ \ s -> (# s, x #)
- m >> k = m >>= \ _ -> k
+ return x = ST (\ s -> (# s, x #))
+ m >> k = m >>= \ _ -> k
(ST m) >>= k
- = ST $ \ s ->
+ = ST (\ s ->
case (m s) of { (# new_s, r #) ->
case (k r) of { ST k2 ->
- (k2 new_s) }}
+ (k2 new_s) }})
data STret s a = STret (State# s) a