Changeset 14122
- Timestamp:
- 10/09/06 17:26:37 (2 years ago)
- Files:
-
- 1 modified
-
src/Pugs/Monads.hs (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
src/Pugs/Monads.hs
r14113 r14122 186 186 -> Eval Val -- ^ Result of passing the pad-transformer to the 187 187 -- \'action\' 188 genSymCC symName action = ca tchT$ \esc -> do188 genSymCC symName action = callCC $ \esc -> do 189 189 genSymPrim symName (const $ esc undef) action 190 190 … … 201 201 | otherwise = do 202 202 env <- ask 203 rv <- if typ >= SubBlock204 then resetT $ do203 rv <- case typ of 204 _ | typ >= SubBlock -> tryT $ do 205 205 doFix <- fixEnv return env 206 206 local doFix runAction 207 else resetT . catchT $ \cc -> do 207 208 -- For coroutines, we secretly store a continuation into subCont 209 -- whenever "yield" occurs in it. However, the inner CC must be 210 -- delimited on the subroutine boundary, otherwise the resuming 211 -- continuation will continue into the rest of the program, 212 -- which is now how coroutines are supposed to work. 213 -- On the other hand, the normal &?CALLER_CONTINUATION must still 214 -- work as an undelimiated continuation, which is why callCC here 215 -- occurs before resetT. 216 SubCoroutine -> tryT . callCC $ \cc -> resetT $ do 217 doFix <- fixEnv cc env 218 local doFix runAction 219 220 _ -> tryT . callCC $ \cc -> do 208 221 doFix <- fixEnv cc env 209 222 local doFix runAction
