From 986affb2a525b6e47a0c9fa43dfd7a089c69bc25 Mon Sep 17 00:00:00 2001 From: sof Date: Mon, 24 Nov 1997 20:08:14 +0000 Subject: [PATCH] [project @ 1997-11-24 20:08:14 by sof] New defn. of sstToIO and ioToRnMG to make them compile with new version of ST and IO --- ghc/compiler/rename/RnMonad.lhs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/ghc/compiler/rename/RnMonad.lhs b/ghc/compiler/rename/RnMonad.lhs index 0d2748d..6385182 100644 --- a/ghc/compiler/rename/RnMonad.lhs +++ b/ghc/compiler/rename/RnMonad.lhs @@ -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 -- 1.7.10.4