From c853c617d1b305baa4e7779ed436ec4fae84cedb Mon Sep 17 00:00:00 2001
From: simonm <unknown>
Date: Wed, 17 Dec 1997 11:21:44 +0000
Subject: [PATCH] [project @ 1997-12-17 11:21:44 by simonm] Add runST.

---
 ghc/lib/glaExts/LazyST.lhs | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/ghc/lib/glaExts/LazyST.lhs b/ghc/lib/glaExts/LazyST.lhs
index 3d457cad3c0d..d18b71608e90 100644
--- a/ghc/lib/glaExts/LazyST.lhs
+++ b/ghc/lib/glaExts/LazyST.lhs
@@ -12,6 +12,7 @@ module LazyST (
 
 	ST,
 
+	runST,
 	unsafeInterleaveST,
 
         -- ST is one, so you'll likely need some Monad bits
@@ -35,6 +36,7 @@ import qualified UnsafeST   ( unsafeInterleaveST )
 import PrelBase	( Eq(..), Int, Bool, ($), ()(..) )
 import Monad
 import Ix
+import GHC
 
 newtype ST s a = ST (STBase.State s -> (a,STBase.State s))
 
@@ -50,6 +52,10 @@ instance Monad (ST s) where
              ST k_a = k r
            in
            k_a new_s
+
+-- ToDo: un-inline this, it could cause problems...
+runST :: (All s => ST s a) -> a
+runST st = case st of ST st -> let (r,_) = st (STBase.S# realWorld#) in r
 \end{code}
 
 %*********************************************************
-- 
GitLab