[GHC] #12163: Incorrect error message when deriving Functor for a GADT
GHC
ghc-devs at haskell.org
Tue Jun 7 14:18:10 UTC 2016
#12163: Incorrect error message when deriving Functor for a GADT
-------------------------------------+-------------------------------------
Reporter: benjamin.hodgson | Owner:
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.10.3
Resolution: | 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: |
-------------------------------------+-------------------------------------
Description changed by benjamin.hodgson:
@@ -20,1 +20,2 @@
- deriving declaration works though.
+ deriving declaration works though. I'm guessing GHC is turning my
+ declaration into `Mk :: (a ~ Int) => a -> b -> T a b`?
New description:
{{{#!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. I'm guessing GHC is turning my
declaration into `Mk :: (a ~ Int) => a -> b -> T a b`?
Tested on 7.10.3 running in OSX Mavericks.
--
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12163#comment:2>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list