GHC sessions (--make, --interactive, GHC API) erroneously retain instances
The EPS (external-package state) is only ever increased, never decreased between compilation of different modules in a single batch compilation or GHCi session.
Example 1 (GHCi):
ezyang@sabre:~/Dev/labs/ezyangest$ ghci
GHCi, version 7.6.3: http://www.haskell.org/ghc/ :? for help
Loading package ghc-prim ... linking ... done.
Loading package integer-gmp ... linking ... done.
Loading package base ... linking ... done.
Prelude> (\x -> x)
<interactive>:2:1:
No instance for (Show (t0 -> t0)) arising from a use of `print'
Possible fix: add an instance declaration for (Show (t0 -> t0))
In a stmt of an interactive GHCi command: print it
Prelude> :m +Text.Show.Functions
Prelude Text.Show.Functions> (\x -> x)
<function>
Prelude Text.Show.Functions> :m -Text.Show.Functions
Prelude> :r
Ok, modules loaded: none.
Prelude> (\x -> x)
<function>
Example 2 (make):
ezyang@sabre:~/Dev/labs/ezyangest$ cat A.hs
module A where
import Text.Show.Functions
ezyang@sabre:~/Dev/labs/ezyangest$ cat B.hs
module B where
y = show (\x -> x)
ezyang@sabre:~/Dev/labs/ezyangest$ ghc --make B.hs A.hs
[1 of 2] Compiling A ( A.hs, A.o )
[2 of 2] Compiling B ( B.hs, B.o )
ezyang@sabre:~/Dev/labs/ezyangest$ ghc --make A.hs B.hs -fforce-recomp
[1 of 2] Compiling B ( B.hs, B.o )
B.hs:2:5:
No instance for (Show (t0 -> t0)) arising from a use of `show'
Possible fix: add an instance declaration for (Show (t0 -> t0))
In the expression: show (\ x -> x)
In an equation for `y': y = show (\ x -> x)
Edited by John Ericson