[project @ 1997-11-24 20:08:14 by sof]
authorsof <unknown>
Mon, 24 Nov 1997 20:08:14 +0000 (20:08 +0000)
committersof <unknown>
Mon, 24 Nov 1997 20:08:14 +0000 (20:08 +0000)
New defn. of sstToIO and ioToRnMG to make them compile with new version of ST and IO

ghc/compiler/rename/RnMonad.lhs

index 0d2748d..6385182 100644 (file)
@@ -33,6 +33,9 @@ import GlaExts
 import IO
 import ST
 import IOBase
+# if __GLASGOW_HASKELL__ >= 209
+import STBase (ST(..), STret(..) )
+# endif
 #define IOError13 IOError
 #define MkIO IO
 #endif
@@ -84,13 +87,31 @@ infixr 9 `thenRn`, `thenRn_`
 
 \begin{code}
 sstToIO :: SST REAL_WORLD r -> IO r
+#if __GLASGOW_HASKELL__ < 209
 sstToIO sst =
     MkIO (
     sstToST sst        `thenStrictlyST` \ r -> 
     returnStrictlyST (Right r))
+#else
+sstToIO sst =
+    IO (\ s ->
+      let (ST st_act) = sstToST sst in
+      case st_act s of
+       STret s' v -> IOok s' v)
+#endif
 
 ioToRnMG :: IO r -> RnMG (Either IOError13 r)
+#if __GLASGOW_HASKELL__ < 209
 ioToRnMG (MkIO io) rn_down g_down = stToSST io
+#else
+ioToRnMG (IO io) rn_down g_down 
+  = stToSST (ST io')
+    where
+     io' st =
+      case io st of 
+       IOok   st' v -> STret st' (Right v)
+       IOfail st' e -> STret st' (Left e)
+#endif
 
 traceRn :: Doc -> RnMG ()
 traceRn msg | opt_D_show_rn_trace = putDocRn msg