[GHC] #14863: QuantifiedConstraints: Can't deduce `c' from `(a, b)' and `a |- b |- c'

GHC ghc-devs at haskell.org
Tue Feb 27 15:18:07 UTC 2018


#14863: QuantifiedConstraints: Can't deduce `c' from `(a, b)' and `a |- b |- c'
-------------------------------------+-------------------------------------
           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:
-------------------------------------+-------------------------------------
 #14833 fixes #14835: we can witness `curryC :: ((a, b) |- c) :- (a |- b |-
 c)`.

 Now for the entirely predictable, how about **un**`curryC`

 {{{#!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)

 uncurryC :: forall a b c. (a |- b |- c) :- ((a, b) |- c)
 uncurryC = Dict
 }}}

 {{{
 $ ghci -ignore-dot-ghci Z.hs
 GHCi, version 8.5.20180128: http://www.haskell.org/ghc/  :? for help
 [1 of 1] Compiling Main             ( Z.hs, interpreted )

 Z.hs:13:12: error:
     • Could not deduce: c arising from a use of ‘Dict’
       from the context: a |- (b |- c)
         bound by a quantified context at Z.hs:1:1
       or from: (a, b) bound by a quantified context at Z.hs:1:1
     • In the expression: Dict
       In an equation for ‘uncurryC’: uncurryC = Dict
     • Relevant bindings include
         uncurryC :: (a |- (b |- c)) :- ((a, b) |- c) (bound at Z.hs:13:1)
    |
 13 | uncurryC = Dict
    |            ^^^^
 Failed, no modules loaded.
 Prelude>
 }}}

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


More information about the ghc-tickets mailing list