X-Git-Url: http://git.megacz.com/?a=blobdiff_plain;ds=sidebyside;f=ghc%2Fcompiler%2Futils%2FSST.lhs;h=631d9c53b796d7427ae0cf76eaa94845a489dfec;hb=f9120c200bcf613b58d742802172fb4c08171f0d;hp=de9c0369102ba7d32dead56c61e8c54eb4309267;hpb=e5401e80e37622869b31d646a25da413c6801bae;p=ghc-hetmet.git diff --git a/ghc/compiler/utils/SST.lhs b/ghc/compiler/utils/SST.lhs index de9c036..631d9c5 100644 --- a/ghc/compiler/utils/SST.lhs +++ b/ghc/compiler/utils/SST.lhs @@ -7,7 +7,7 @@ module SST( SST(..), SST_R, FSST(..), FSST_R, - _runSST, + _runSST, sstToST, stToSST, thenSST, thenSST_, returnSST, thenFSST, thenFSST_, returnFSST, failFSST, recoverFSST, recoverSST, fixFSST, @@ -16,7 +16,7 @@ module SST( newMutVarSST, readMutVarSST, writeMutVarSST ) where -import PreludeGlaST( MutableVar(..), _MutableArray(..) ) +import PreludeGlaST( MutableVar(..), _MutableArray(..), ST(..) ) CHK_Ubiq() -- debugging consistency check \end{code} @@ -27,6 +27,17 @@ type SST s r = State# s -> SST_R s r \end{code} \begin{code} +-- converting to/from ST + +sstToST :: SST s r -> ST s r +stToSST :: ST s r -> SST s r + +sstToST sst (S# s) + = case sst s of SST_R r s' -> (r, S# s') +stToSST st s + = case st (S# s) of (r, S# s') -> SST_R r s' + + -- Type of runSST should be builtin ... -- runSST :: forall r. (forall s. SST s r) -> r