[GHC] #9948: Recommend class constraint instead of instance constraint
GHC
ghc-devs at haskell.org
Tue Jan 20 15:04:21 UTC 2015
#9948: Recommend class constraint instead of instance constraint
-------------------------------------+-------------------------------------
Reporter: crockeea | Owner:
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 7.8.4
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: None/Unknown | Unknown/Multiple
Blocked By: | Test Case:
Related Tickets: | Blocking:
| Differential Revisions:
-------------------------------------+-------------------------------------
Comment (by goldfire):
Replying to [comment:4 crockeea]:
> I'm suggesting that if `foo` is a method of class `Foo`, then GHC simply
says `cannot deduce (Foo a)`. There's no need to match instances at all.
However, we would, of course, still like to find an instance where
possible. Just determining if an instance exists requires looking up
instances for `Foo`, and then perhaps recurring on any constraints to
those instances. At the end of a chain of instance constraints, we might
end up with some constraint, say `Bar Int a`, that is unsatisfiable. Only
then do we know that no instance matches the original constraint. To
report a missing `Foo a` constraint at this point, we would need to
somehow the need for `Bar Int a` came from a desire for `Foo a`. Keeping
track of this is the "more work" I was talking about. Nowhere near
impossible, but strictly harder than what happens currently.
In any case, I think the discussion about how hard this feature is to
implement detracts from the debate we should be having: what is really the
desired behavior, regardless of implementation challenge. (To be clear,
the implementation is not particularly challenging here, I think -- just
not completely trivial.) And, regardless of implementation issues, I
prefer the current behavior over the new one proposed in this ticket.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/9948#comment:5>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list