TH-reified type classes have redundant tyvars/class constraints on each method
If you try to reify a type class in Template Haskell, as in the following example:
{-# LANGUAGE TemplateHaskell #-}
module Bug where
import Language.Haskell.TH
class C a where
method :: a
$(pure [])
main :: IO ()
main = putStrLn $(reify ''C >>= stringE . pprint)
You'll discover something strange:
$ /opt/ghc/8.4.3/bin/runghc Bug.hs
class Bug.C (a_0 :: *)
where Bug.method :: forall (a_0 :: *) . Bug.C a_0 => a_0
Notice how method
has a completely redundant forall (a_0 :: *) . Bug.C a_0 =>
! I find this very strange, and would have expected to simply see Bug.method :: a_0
instead.
Currently, I have to work around this oddity by manually stripping off the forall (a_0 :: *) . Bug.C a_0 =>
myself, but it would be nice if I didn't have to do so. Does this proposal sound reasonable?
Trac metadata
Trac field | Value |
---|---|
Version | 8.4.3 |
Type | Bug |
TypeOfFailure | OtherFailure |
Priority | normal |
Resolution | Unresolved |
Component | Template Haskell |
Test case | |
Differential revisions | |
BlockedBy | |
Related | |
Blocking | |
CC | |
Operating system | |
Architecture |