[project @ 2003-03-11 18:41:43 by panne]
[ghc-base.git] / GHC / ST.lhs
index f98b33d..65bf835 100644 (file)
@@ -1,13 +1,18 @@
-% ------------------------------------------------------------------------------
-% $Id: ST.lhs,v 1.1 2001/06/28 14:15:03 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
 
@@ -40,14 +45,14 @@ instance Monad (ST s) 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
 
@@ -118,9 +123,9 @@ runST :: (forall s. ST s a) -> a
 runST st = runSTRep (case st of { ST st_rep -> st_rep })
 
 -- I'm only letting runSTRep be inlined right at the end, in particular *after* full laziness
--- That's what the "INLINE 100" says.
+-- That's what the "INLINE [0]" says.
 --             SLPJ Apr 99
-{-# INLINE 100 runSTRep #-}
+{-# INLINE [0] runSTRep #-}
 runSTRep :: (forall s. STRep s a) -> a
 runSTRep st_rep = case st_rep realWorld# of
                        (# _, r #) -> r