
#14835: QuantifiedConstraints: Can't deduce "(a, b)" from "a" and "b" -------------------------------------+------------------------------------- Reporter: Iceland_jack | Owner: (none) Type: bug | Status: new Priority: normal | Milestone: Component: Compiler | Version: 8.5 Keywords: | Operating System: Unknown/Multiple QuantifiedConstraints wipT2893 | Architecture: | Type of failure: None/Unknown Unknown/Multiple | Test Case: | Blocked By: Blocking: | Related Tickets: Differential Rev(s): | Wiki Page: -------------------------------------+------------------------------------- {{{#!hs {-# Language QuantifiedConstraints, RankNTypes, PolyKinds, ConstraintKinds, UndecidableInstances, GADTs, LiberalTypeSynonyms, TypeOperators, MultiParamTypeClasses, FlexibleInstances #-} data Dict c where Dict :: c => Dict c infixr |- class (a => b) => (a |- b) instance (a => b) => (a |- b) type a :- b = Dict (a |- b) class ((a, b) => c) => Curried a b c instance ((a, b) => c) => Curried a b c curryC :: forall a b c. ((a, b) |- c) :- (a |- b |- c) curryC = Dict }}} This fails with {{{ GHCi, version 8.5.20180128: http://www.haskell.org/ghc/ :? for help [1 of 1] Compiling Main ( /tmp/Test.hs, interpreted ) /tmp/Test.hs:16:10: error: • Could not deduce (a, b) arising from a use of ‘Dict’ from the context: (a, b) |- c bound by a quantified context at /tmp/Test.hs:1:1 or from: a bound by a quantified context at /tmp/Test.hs:1:1 or from: b bound by a quantified context at /tmp/Test.hs:1:1 Possible fix: add (a, b) to the context of the type signature for: curryC :: forall (a :: Constraint) (b :: Constraint) (c :: Constraint). ((a, b) |- c) :- (a |- (b |- c)) • In the expression: Dict In an equation for ‘curryC’: curryC = Dict | 16 | curryC = Dict | ^^^^ Failed, no modules loaded. }}} but it works by changing the type of `curryC`: {{{#!hs curryC :: forall a b c. Curried a b c :- (a |- b |- c) }}} -- Ticket URL: http://ghc.haskell.org/trac/ghc/ticket/14835 GHC http://www.haskell.org/ghc/ The Glasgow Haskell Compiler