[GHC] #12163: Incorrect error message when deriving Functor
#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
#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: | -------------------------------------+------------------------------------- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12163#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#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
#12163: Surprising 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: | -------------------------------------+------------------------------------- -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12163#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12163: Surprising 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: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"cc92a446d6932cf06364529e71c866289088c59a/ghc" cc92a44/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="cc92a446d6932cf06364529e71c866289088c59a" Improve error message in deriving( Functor ) Fixes Trac #12163. Pretty simple. }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12163#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12163: Surprising 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: | -------------------------------------+------------------------------------- Comment (by Simon Peyton Jones <simonpj@…>): In [changeset:"210a2e122ce3b7c56c780e4541b9f222abe7d2f7/ghc" 210a2e1/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="210a2e122ce3b7c56c780e4541b9f222abe7d2f7" Test Trac #12163 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12163#comment:5> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12163: Surprising error message when deriving Functor for a GADT -------------------------------------+------------------------------------- Reporter: benjamin.hodgson | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 7.10.3 Resolution: fixed | Keywords: Operating System: MacOS X | Architecture: x86_64 | (amd64) Type of failure: Incorrect | Test Case: warning at compile-time | deriving/should_fail/T12163 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by simonpj): * testcase: => deriving/should_fail/T12163 * status: new => closed * resolution: => fixed * milestone: => 8.2.1 Comment: Good idea thanks. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12163#comment:6> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC