[GHC] #15351: QuantifiedConstraints ignore FunctionalDependencies
GHC
ghc-devs at haskell.org
Mon Jul 9 08:50:59 UTC 2018
#15351: QuantifiedConstraints ignore FunctionalDependencies
-------------------------------------+-------------------------------------
Reporter: aaronvargo | Owner: (none)
Type: bug | Status: new
Priority: normal | Milestone:
Component: Compiler (Type | Version: 8.5
checker) | Keywords:
Resolution: | QuantifiedConstraints
Operating System: Unknown/Multiple | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: | Differential Rev(s):
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by simonpj):
> this doesn't explain what specifically GHC "checks it against" in this
case
It's worth reading the original paper -- though alas I cannot find PDF
online.
Given
{{{
class C a b | a -> b
instance C Int Bool
}}}
if GHC finds a wanted constraint `[W] C Int t`, it compares it against all
the top-level instances to see if the fist argument of `C` matches the one
in the instance. It succeeds in this case, and emits a new Derived
constraint `[D] t ~ Bool`.
Quantified constraints behave very like top-level instances, so they too
should be examined in this search.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/15351#comment:8>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list