[GHC] #15351: QuantifiedConstraints ignore FunctionalDependencies

GHC ghc-devs at haskell.org
Mon Jul 9 07:46:32 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 AntC):

 Replying to [comment:5 goldfire]:
 >
 > {{{#!hs
 > bar :: (forall b. C (f b) Int) => f a -> String
 > bar = show . foo
 > }}}
 >
 > So, since the usage of `foo` induces a `C (f a) alpha` constraint (for
 some unknown `alpha`) we can conclude that `alpha` must be `Int` by the
 fundep.
 >

 Hmm (and accepting for the moment this is a legitimate
 `QuantifiedConstraint`). The OP doesn't include any `C` instance for the
 `f` in `bar` -- i.e. evidence for `C (f b) alpha`.  Is that what the
 message `Could not deduce (C (f a) a0) arising from a use of ‘foo’` is
 saying? Is there another message the OP hasn't included `no instance for
 (C (f a) a0) ...`?

 The fact of the message saying ''deduce'' suggests it's trying to do apply
 some sort of implication?? Deduce what from what? (Simon's comment:6 that
 arrived as I was writing this doesn't explain what specifically GHC
 "checks it against" in this case.)

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


More information about the ghc-tickets mailing list