Commit 290ec750 authored by Simon Marlow's avatar Simon Marlow

Add a comment to explain why the FCode monad is lazy

parent 5620662e
......@@ -113,7 +113,8 @@ cgBind (StgRec pairs)
; addBindsC new_binds
; emit (catAGraphs inits <*> body) }
{- Recursive let-bindings are tricky.
{- Note [cgBind rec]
Recursive let-bindings are tricky.
Consider the following pseudocode:
let x = \_ -> ... y ...
y = \_ -> ... z ...
......
......@@ -143,6 +143,13 @@ thenFC (FCode m) k = FCode (
in
kcode info_down new_state
)
-- Note: this is a lazy monad. We can't easily make it strict due
-- to the use of fixC for compiling recursive bindings (see Note
-- [cgBind rec]). cgRhs returns a CgIdInfo which is fed back in
-- via the CgBindings, and making the monad strict means that we
-- can't look at the CgIdInfo too early. Things seem to just
-- about work when the monad is lazy. I hate this stuff --SDM
listFCs :: [FCode a] -> FCode [a]
listFCs = Prelude.sequence
......
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