[GHC] #10087: DefaultSignatures: error message mentions internal name

GHC ghc-devs at haskell.org
Sat Feb 14 14:18:58 UTC 2015


#10087: DefaultSignatures: error message mentions internal name
-------------------------------------+-------------------------------------
              Reporter:              |             Owner:
  andreas.abel                       |            Status:  new
                  Type:  feature     |         Milestone:
  request                            |           Version:  7.8.4
              Priority:  normal      |  Operating System:  Unknown/Multiple
             Component:  Compiler    |   Type of failure:  Other
  (Type checker)                     |        Blocked By:
              Keywords:              |   Related Tickets:
          Architecture:              |
  Unknown/Multiple                   |
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
 {{{#!hs
 {-# LANGUAGE DefaultSignatures #-}

 class C a where
   reflexive :: a -> Bool
   default reflexive :: Eq a => a -> Bool
   reflexive x = x == x

 data D

 instance C D where

 -- /home/abel/play/haskell/bugs/DefaultSig.hs:10:10:
 --     No instance for (Eq D) arising from a use of ‘Main.$gdmreflexive’
 --     In the expression: Main.$gdmreflexive
 --     In an equation for ‘reflexive’: reflexive = Main.$gdmreflexive
 --     In the instance declaration for ‘C D’
 }}}

 Error looks odd: The user has not written $gdmreflexive in his code.

 TODO: Better error message.

 Maybe this should just trigger a warning that method {{{reflexive}}} is
 undefined for instance {{{D}}} of {{{C}}}.  Like when I remove the default
 method.

 {{{
 /home/abel/play/haskell/bugs/DefaultSig.hs:10:10: Warning:
     No explicit implementation for
       ‘reflexive’
     In the instance declaration for ‘C D’
 }}}

 It seems the semantics of a default signature is that each instance *must*
 implement this method.

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


More information about the ghc-tickets mailing list