
#15244: Ambiguity checks in QuantifiedConstraints -------------------------------------+------------------------------------- Reporter: bitwiseshiftleft | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: 8.6.1 Component: Compiler | Version: 8.5 Resolution: | Keywords: | QuantifiedConstraints Operating System: Unknown/Multiple | Architecture: | Unknown/Multiple Type of failure: None/Unknown | Test Case: Blocked By: | Blocking: Related Tickets: | Differential Rev(s): Wiki Page: | -------------------------------------+------------------------------------- Comment (by simonpj): {{{ bar :: (forall t . Eq (a t), forall t . Eq (b t), a ~ b) => a t -> b t -> Bool }}} You'd never write this, correct? Because if `a~b` then the two quantified constraints are identical. But your point is that in {{{ class (forall t . Eq (c t)) => Blah c baz :: (Blah a, Blah b, a ~ b) => a t -> b t -> Bool }}} you can't avoid having two identical superclass constraints. In general if we have two quantified constraints {{{ forall a. Q1 => t a forall a. Q2 => t a }}} and we have to solve `t Int`, say, GHC doesn't know which to pick. (Solving Q1 might be easier than Q2; we don't know.) So it picks neither. And that is what is happening here. But in this case the quantified constraints are ''identical''; but GHC doesn't currently spot that. It would not be hard to combine identical quantified constraints, which would solve this problem. Is this an application that matters to you? -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/15244#comment:2 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler