Commit 1e15be89 authored by Clemens Fruhwirth's avatar Clemens Fruhwirth

Fix the knot-tying in loopDecls to actually do what its comment tells: provide...

Fix the knot-tying in loopDecls to actually do what its comment tells: provide access to global declarations
parent 1e793a16
......@@ -770,9 +770,12 @@ instance Monad ExtFCode where
-- an environment, which is looped back into the computation. In this
-- way, we can have embedded declarations that scope over the whole
-- procedure, and imports that scope over the entire module.
-- Discards the local declaration contained within decl'
loopDecls :: ExtFCode a -> ExtFCode a
loopDecls (EC fcode) =
EC $ \e s -> fixC (\ ~(decls,a) -> fcode (addListToUFM e decls) [])
loopDecls (EC fcode) =
EC $ \e globalDecls -> do
(decls', a) <- fixC (\ ~(decls,a) -> fcode (addListToUFM e (decls ++ globalDecls)) globalDecls)
return (globalDecls, a)
getEnv :: ExtFCode Env
getEnv = EC $ \e s -> return (s, e)
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment