[GHC] #9650: Unsatisfiable default signature

GHC ghc-devs at haskell.org
Tue Sep 30 09:04:03 UTC 2014


#9650: Unsatisfiable default signature
-------------------------------------+-------------------------------------
              Reporter:  crockeea    |            Owner:
                  Type:  bug         |           Status:  new
              Priority:  normal      |        Milestone:
             Component:  Compiler    |          Version:  7.8.3
            Resolution:              |         Keywords:
      Operating System:              |     Architecture:  Unknown/Multiple
  Unknown/Multiple                   |       Difficulty:  Unknown
       Type of failure:  GHC         |       Blocked By:
  accepts invalid program            |  Related Tickets:
             Test Case:              |
              Blocking:              |
Differential Revisions:              |
-------------------------------------+-------------------------------------
Changes (by simonpj):

 * cc: dreixel (added)


Comment:

 You point is, I think, that constraints that constrain ''only'' `b` (in
 this example) cannot possibly be satisfied at the usage site.  If you
 wrote
 {{{
 class Foo a where
   foo :: ...blah..
   default foo :: forall b. (C a b) => ...blah...
   foo = ...
 }}}
 then a suitable instance for `C` (e.g. `instance C Int b`) might allow the
 `C a b` constraint to be satisfied at the `instance` declaration.

 However, nothing stops you writing
 {{{
 instance Integral b where ...
 }}}
 and now the constraint would be satisfied.  You may say this is silly, but
 people do write instance declarations like this (often `OVERLAPPABLE`).

 So I think the most we could do would be to warn that the default
 signature looks fishy.  And then people would want a way to suppress the
 warning....

 In short, there is merit in what you say, but I don't see an obvious way
 to take advantage of your observation.

 Simon

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


More information about the ghc-tickets mailing list