[GHC] #8567: Poor error message when GeneralizedNewtypeDeriving fails

GHC ghc-devs at haskell.org
Thu Nov 28 12:11:44 UTC 2013


#8567: Poor error message when GeneralizedNewtypeDeriving fails
-------------------------------------+------------------------------------
        Reporter:  goldfire          |            Owner:
            Type:  bug               |           Status:  new
        Priority:  normal            |        Milestone:
       Component:  Compiler          |          Version:  7.7
      Resolution:                    |         Keywords:
Operating System:  Unknown/Multiple  |     Architecture:  Unknown/Multiple
 Type of failure:  None/Unknown      |       Difficulty:  Unknown
       Test Case:                    |       Blocked By:
        Blocking:                    |  Related Tickets:
-------------------------------------+------------------------------------

Comment (by simonpj):

 There are two parts to this:

 * It would be dead easy to generate a better error message for an unsolved
 constraint `Coerce Int Bool`.  Rather than generating a generic type-class
 error message, it'd be easy to produce a message about the inability to
 coerce `Int` to `Bool`.  Error messages are generated by `TcErrors`.  We
 already generate special error messages for implicit parameters, which are
 already type-class constraints; `?x:Int` is short for `IP "x" Int`.

 * The "arising from a use of corece" part is also generated in `TcErrors`.
 Again, it'd be easy to change the form of the message for a call to
 `coerce`.

 * A bit harder to omit the `In the expression`, `In the definition of
 meth` parts.  They might even be helpful, if we explain in the manual how
 `newtype deriving` actually works (via `corece`).

 I'd be happy to advise

 Simon

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


More information about the ghc-tickets mailing list