[GHC] #12787: Weird type constraint with undecidable instances
GHC
ghc-devs at haskell.org
Tue Nov 1 12:57:14 UTC 2016
#12787: Weird type constraint with undecidable instances
-------------------------------------+-------------------------------------
Reporter: nome | Owner:
Type: bug | Status: closed
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.0.1
checker) | Keywords:
Resolution: invalid | UndecidableInstances
Operating System: Linux | Architecture: x86_64
Type of failure: GHC rejects | (amd64)
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by goldfire):
No worries about the noise -- and sorry if my initial response was a bit
curt. This is confusing territory to be sure!
For me, the key that unlocked all of this was to realize that instance
selection always ignores contexts. So GHC will choose an instance based
only on the instance head (that is, the bit to the right of `=>`). Only
then will it try to satisfy the context.
More elaborate instance selection control is possible with type families,
but I'm afraid I can't find a decent, introductory example of how to do
this.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/12787#comment:4>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list