Skip to content

GHC HEAD accepts a manual instance decl but not equivalent TH decl

If I try to build the traverse-with-class package with GHC HEAD, I get an error:

Data/Generics/Traversable/Instances.hs:21:1:
    Illegal type constructor or class name: ‘c’
    When splicing a TH declaration:
      instance c_0 a_1 => Data.Generics.Traversable.Core.GTraversable c_0
                                                                (Data.Maybe.Maybe a_1)
    where Data.Generics.Traversable.Core.gtraverse = \f_2 x_3 -> case x_3 of
                                                                     Data.Maybe.Nothing -> Control.Applicative.pure Data.Maybe.Nothing
                                                                     Data.Maybe.Just arg_4 -> (Control.Applicative.<*>) (Control.Applicative.pure Data.Maybe.Just) (f_2 arg_4)

This code used to compile with all the previous versions. Additionally, if I replace the TH splice with the generated instance declaration (with minimal corrections to make all names resolve), it is accepted:

instance c_0 a_1 => Data.Generics.Traversable.Core.GTraversable c_0
                                                                (Maybe a_1)
    where gtraverse = \f_2 x_3 -> case x_3 of
                                                                     Nothing -> Control.Applicative.pure Nothing
                                                                     Just arg_4 -> (Control.Applicative.<*>) (Control.Applicative.pure Just) (f_2 arg_4)
Trac metadata
Trac field Value
Version 7.9
Type Bug
TypeOfFailure OtherFailure
Priority normal
Resolution Unresolved
Component Compiler
Test case
Differential revisions
BlockedBy
Related
Blocking
CC
Operating system
Architecture
To upload designs, you'll need to enable LFS and have an admin enable hashed storage. More information