[GHC] #9270: GHC HEAD accepts a manual instance decl but not equivalent TH decl

GHC ghc-devs at haskell.org
Sat Jul 5 18:56:05 UTC 2014


#9270: GHC HEAD accepts a manual instance decl but not equivalent TH decl
------------------------------------+-------------------------------------
       Reporter:  Feuerbach         |             Owner:
           Type:  bug               |            Status:  new
       Priority:  normal            |         Milestone:
      Component:  Compiler          |           Version:  7.9
       Keywords:                    |  Operating System:  Unknown/Multiple
   Architecture:  Unknown/Multiple  |   Type of failure:  None/Unknown
     Difficulty:  Unknown           |         Test Case:
     Blocked By:                    |          Blocking:
Related Tickets:                    |
------------------------------------+-------------------------------------
 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)
 }}}

--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9270>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler


More information about the ghc-tickets mailing list