[project @ 2003-02-04 12:33:05 by simonpj]
authorsimonpj <unknown>
Tue, 4 Feb 2003 12:33:07 +0000 (12:33 +0000)
committersimonpj <unknown>
Tue, 4 Feb 2003 12:33:07 +0000 (12:33 +0000)
commite6d004928bcd0e71ba58c034b6fe4c870e6a70cb
tree79d3af04b190f4c338ba436db6df9fcebd95f0bb
parent115f0fae2f782836550a9419f739fd29c09e4f1b
[project @ 2003-02-04 12:33:05 by simonpj]
---------------------------------------------------
Template-Haskell fix to make the global environment
      more side-effect-ful
---------------------------------------------------

Consider

f = $(...foldl...) $(...foldl...)

The first splice sucks in the type sig for foldl, which the second
splice needs.  That means that the second splice is going to have to
consult the persistent compiler state to see the effect of imports
by the first one.

We used to cache the global type environment in the TcGblEnv, but
this commit switches to the obvious thing: consult the persistent
state on every global lookup.  After all, reading a MutVar is no
big deal; and it's a benign, ever-growing cache of type signatures,
so the side effect is fine.

On the way I tidied up the knot-tying in TcIfaceSig a bit more.
Previously, I think the setUnfoldingInfo was being strict in the
unfolding, which forced it to be type-checked.  Now it's lazy.
That could mean a lot less typechecking overall, for things whose
unfolding isn't looked at.  I hope I havn't broken it, though.
ghc/compiler/basicTypes/IdInfo.lhs
ghc/compiler/typecheck/TcEnv.lhs
ghc/compiler/typecheck/TcIfaceSig.lhs
ghc/compiler/typecheck/TcRnDriver.lhs
ghc/compiler/typecheck/TcRnMonad.lhs
ghc/compiler/typecheck/TcRnTypes.lhs
ghc/compiler/typecheck/TcRules.lhs
ghc/compiler/typecheck/TcSplice.lhs