The definition of cseProgram

David Feuer david.feuer at
Mon Aug 18 21:42:14 UTC 2014

Currently, it's defined like this:

cseProgram :: CoreProgram -> CoreProgram
cseProgram binds = cseBinds emptyCSEnv binds

cseBinds :: CSEnv -> [CoreBind] -> [CoreBind]
cseBinds _ [] = []
cseBinds env (b:bs) = (b':bs')
                      (env1, b') = cseBind env b
                      bs' = cseBinds env1 bs

Couldn't we replace all that with the following? (Thanks to Cale for
suggesting mapAccumL—I was using scanl because I knew it, but it was not a
great fit.)

cseProgram = snd . mapAccumL cseBind emptyCSEnv

David Feuer
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the ghc-devs mailing list