[GHC] #14833: QuantifiedConstraints: GHC can't deduce (() :: Constraint)?

GHC ghc-devs at haskell.org
Wed Feb 21 11:09:51 UTC 2018


#14833: QuantifiedConstraints: GHC can't deduce (() :: Constraint)?
-------------------------------------+-------------------------------------
           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 #-}

 import Data.Kind

 data Dict c where
   Dict :: c => Dict c

 class    (a => b) => Implies a b
 instance (a => b) => Implies a b

 type a :- b = Dict (Implies a b)

 iota :: (Implies () a) :- a
 iota = Dict
 }}}

 GHC claims that it can't deduce `(() :: Constraint)` :)

 {{{
 GHCi, version 8.5.20180128: http://www.haskell.org/ghc/  :? for help
 [1 of 1] Compiling Main             ( /tmp/H.hs, interpreted )

 /tmp/H.hs:14:8: error:
     • Could not deduce () :: Constraint arising from a use of ‘Dict’
       from the context: Implies () :: Constraint a
         bound by a quantified context at /tmp/H.hs:1:1
       Possible fix:
         add () :: Constraint to the context of
           the type signature for:
             iota :: forall (a :: Constraint). Implies () :: Constraint a
 :- a
     • In the expression: Dict
       In an equation for ‘iota’: iota = Dict
    |
 14 | iota = Dict
    |        ^^^^
 Failed, no modules loaded.
 Prelude>
 }}}

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


More information about the ghc-tickets mailing list