[GHC] #12163: Incorrect error message when deriving Functor

GHC ghc-devs at haskell.org
Tue Jun 7 14:14:59 UTC 2016


#12163: Incorrect error message when deriving Functor
-------------------------------------+-------------------------------------
           Reporter:                 |             Owner:
  benjamin.hodgson                   |
               Type:  bug            |            Status:  new
           Priority:  normal         |         Milestone:
          Component:  Compiler       |           Version:  7.10.3
           Keywords:                 |  Operating System:  MacOS X
       Architecture:  x86_64         |   Type of failure:  Incorrect
  (amd64)                            |  warning at compile-time
          Test Case:                 |        Blocked By:
           Blocking:                 |   Related Tickets:
Differential Rev(s):                 |         Wiki Page:
-------------------------------------+-------------------------------------
 {{{#!hs
 {-# LANGUAGE DeriveFunctor #-}
 {-# LANGUAGE GADTs #-}

 data T a b where
     Mk :: Int -> b -> T Int b
     deriving (Functor)
 }}}

 GHC says:
 {{{
     Can't make a derived instance of ‘Functor (T a)’:
       Constructor ‘Mk’ has existentials or constraints in its type
       Possible fix: use a standalone deriving declaration instead
     In the data declaration for ‘T’
 }}}

 This is not true - Mk does not existentially quantify anything, nor does
 it have a constraint in its type. The suggested fix of using a standalone
 deriving declaration works though.

 Tested on 7.10.3 running in OSX Mavericks.

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


More information about the ghc-tickets mailing list