[GHC] #12801: Misleading error message when deriving Functor
#12801: Misleading error message when deriving Functor -------------------------------------+------------------------------------- Reporter: erikd | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Keywords: | Operating System: Unknown/Multiple Architecture: | Type of failure: Poor/confusing Unknown/Multiple | error message Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- Compiling this trivial demo program: {{{ data Container = Container [Wibble Int] deriving (Eq, Show) data Wibble a = Wibble a | Wobble deriving (Eq, Functor, Show) }}} results in the error message: {{{ a.hs:6:13: error: • No instance for (Eq (Wibble Int)) arising from the first field of ‘Container’ (type ‘[Wibble Int]’) Possible fix: use a standalone 'deriving instance' declaration, so you can specify the instance context yourself • When deriving the instance for (Eq Container) a.hs:6:17: error: • No instance for (Show (Wibble Int)) arising from the first field of ‘Container’ (type ‘[Wibble Int]’) Possible fix: use a standalone 'deriving instance' declaration, so you can specify the instance context yourself • When deriving the instance for (Show Container) a.hs:12:17: error: • Can't make a derived instance of ‘Functor Wibble’: You need DeriveFunctor to derive an instance for this class • In the data declaration for ‘Wibble’ }}} The "No instance for (Eq|Show)" are rather misleading, because the *actual* error is that the `{-# LANGUAGE DeriveFunctor #-}` pragma is missing. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12801> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12801: Misleading error message when deriving Functor -------------------------------------+------------------------------------- Reporter: erikd | Owner: Type: bug | Status: new Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by RyanGlScott): I think this is a duplicate of #10684, as the failure to derive `Functor` for `Wibble` prevents `Eq` and `Show` from being derived for `Wibble`, causing a cascade of error messages for `Container`. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12801#comment:1> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12801: Misleading error message when deriving Functor -------------------------------------+------------------------------------- Reporter: erikd | Owner: Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by erikd): * status: new => closed * resolution: => duplicate Comment: Yes, this is a dupe of #10684. -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12801#comment:2> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12801: Misleading error message when deriving Functor -------------------------------------+------------------------------------- Reporter: erikd | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.2.1 Component: Compiler | Version: 8.0.1 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: Type of failure: Poor/confusing | Unknown/Multiple error message | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by Ryan Scott <ryan.gl.scott@…>): In [changeset:"6bb32ba78580271921e3d5c3c98afac2c1b68de4/ghc" 6bb32ba/ghc]: {{{ #!CommitTicketReference repository="ghc" revision="6bb32ba78580271921e3d5c3c98afac2c1b68de4" Fix #10684 by processing deriving clauses with finer grain Summary: Previously, one could experience error cascades with deriving clauses when one class in a set of many failed to derive, causing the other derived classes to be skipped entirely and resulting in other errors down the line. The solution is to process each class in a data type's set of deriving clauses individually, and engineer it so that failure to derive an individual class within that set doesn't cancel out the others. Test Plan: make test TEST="T10684 T12801" Reviewers: austin, bgamari, simonpj Reviewed By: simonpj Subscribers: simonpj, rwbarton, thomie GHC Trac Issues: #10684, #12801 Differential Revision: https://phabricator.haskell.org/D3771 }}} -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12801#comment:3> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
#12801: Misleading error message when deriving Functor -------------------------------------+------------------------------------- Reporter: erikd | Owner: (none) Type: bug | Status: closed Priority: normal | Milestone: 8.4.1 Component: Compiler | Version: 8.0.1 Resolution: duplicate | Keywords: Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: Poor/confusing | Test Case: error message | deriving/should_fail/T12801 Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Changes (by RyanGlScott): * testcase: => deriving/should_fail/T12801 * milestone: 8.2.1 => 8.4.1 -- Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12801#comment:4> GHC <http://www.haskell.org/ghc/> The Glasgow Haskell Compiler
participants (1)
-
GHC