Define and use PprTyThing.pprTypeForUser
authorsimonpj@microsoft.com <unknown>
Tue, 11 Sep 2007 08:51:23 +0000 (08:51 +0000)
committersimonpj@microsoft.com <unknown>
Tue, 11 Sep 2007 08:51:23 +0000 (08:51 +0000)
commit046feb1ea3b3dafb21c43fda88778198c1c709d6
treece9eff840daa9362b4166ff69b8c23e83b5a958a
parentdeda0c55629600e886f47a5e90bad67953df1ad8
Define and use PprTyThing.pprTypeForUser

When printing types for the user, the interactive UI often wants to
leave foralls implicit.  But then (as Claus points out) we need to be
careful about name capture. For example with this source program

class C a b where
  op :: forall a. a -> b

we were erroneously displaying the class in GHCi (with suppressed
foralls) thus:

class C a b where
  op :: a -> b

which is utterly wrong.

This patch fixes the problem, removes GHC.dropForAlls (which is dangerous),
and instead supplies PprTyThing.pprTypeForUser, which does the right thing.
compiler/ghci/InteractiveUI.hs
compiler/main/GHC.hs
compiler/main/PprTyThing.hs