[GHC] #14861: QuantifiedConstraints: Can't use forall'd variable in context

GHC ghc-devs at haskell.org
Tue Feb 27 16:56:24 UTC 2018


#14861: QuantifiedConstraints: Can't use forall'd variable in context
-------------------------------------+-------------------------------------
        Reporter:  RyanGlScott       |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler (Type    |              Version:  8.5
  checker)                           |             Keywords:
      Resolution:                    |  QuantifiedConstraints wipT2893
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by simonpj):

 No, p is not a skolem.  Think of the quantified constraint like a local
 instance decl.  It says
 {{{
  local instance forall p. c p => Foldable' f
 }}}
 That means, if you want to solve `Foldable' f` (where `f` really is a
 skolem coming from the instance for `Foldable' (ECC1 c f)`), then

 * If you can solve `c beta`, where you are free to pick beta
 * then you can solve `Foldable' f`

 So we have to guess `beta`. And we can't.

 Try some top level instances with tyars on the left which don't appear on
 the right
 {{{
 instance C a => C [b]
 }}}

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


More information about the ghc-tickets mailing list