Re: [GHC] #14046: “Illegal type synonym family application in instance” is too strict in the presence of functional dependencies
GHC
ghc-devs at haskell.org
Mon Jul 31 08:08:39 UTC 2017
#14046: “Illegal type synonym family application in instance” is too strict in the
presence of functional dependencies
-------------------------------------+-------------------------------------
Reporter: lexi.lambda | Owner: (none)
Type: feature request | Status: new
Priority: normal | Milestone:
Component: Compiler | Version: 8.0.1
Resolution: | Keywords:
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: #3485 | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
> I could be convinced by an example of the sort that SPJ alluded to, in
which an instance of the form Multi X (Y a) behaves differently from (b ~
Y a) => Multi X b,
It affects type inference:
{{{
instance (a ~ Int) => C a
instance (a ~ Bool) => C a
vs
instance C Int
instance C Bool
}}}
GHC's type inference engine does not support backtracking. If it did, it
could try out the former two instances one at a time, and see which one
"worked". With the latter two, only one matches.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/14046#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list