#14835 closed bug (fixed)
QuantifiedConstraints: Can't deduce "(a, b)" from "a" and "b"
Reported by: | Iceland_jack | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | |
Component: | Compiler | Version: | 8.5 |
Keywords: | QuantifiedConstraints | Cc: | |
Operating System: | Unknown/Multiple | Architecture: | Unknown/Multiple |
Type of failure: | None/Unknown | Test Case: | quantified-constraints/T14835 |
Blocked By: | Blocking: | ||
Related Tickets: | #14833 | Differential Rev(s): | |
Wiki Page: |
Description
{-# 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
:
curryC :: forall a b c. Curried a b c :- (a |- b |- c)
Change History (3)
comment:1 Changed 19 months ago by
Related Tickets: | → #14833 |
---|
comment:2 Changed 19 months ago by
Resolution: | → fixed |
---|---|
Status: | new → closed |
Test Case: | → quantified-constraints/T14835 |
Yes, fixed with #14833.
comment:3 Changed 16 months ago by
Keywords: | wipT2893 removed |
---|
Note: See
TracTickets for help on using
tickets.
I think this is another manifestation of #14833. Here's an analogous removal of cruft for this ticket:
Note that
curryC1
typechecks, butcurryC2
does not.