[GHC] #14961: QuantifiedConstraints: introducing classes through equality constraints fails

GHC ghc-devs at haskell.org
Thu Mar 22 12:36:57 UTC 2018


#14961: QuantifiedConstraints: introducing classes through equality constraints
fails
-------------------------------------+-------------------------------------
        Reporter:  mrkgnao           |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.5
      Resolution:                    |             Keywords:
                                     |  QuantifiedConstraints wipT2893
Operating System:  Unknown/Multiple  |         Architecture:
 Type of failure:  GHC rejects       |  Unknown/Multiple
  valid program                      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:  #14860            |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by mrkgnao):

 I think it would be good to add it as a regression test. Optics seem like
 an area where `QuantifiedConstraints` could simplify many things a lot!

 Also, is the incompatibility of `QuantifiedConstraints`-using bindings
 with `:type` in GHCi, or the inability to write, e.g.

 {{{#!hs
 _Left1
   :: c ~=> Choice
   => Glass c '(Either a x, Either b x) '(a, b)
 _Left1 = Glass left'

 _Left4 = _Left1

 {- src/Main.hs:73:10: error:
     • Could not deduce (Choice x1) arising from a use of ‘_Left1’
       from the context: c x1
         bound by a quantified context at src/Main.hs:73:1-15
       Possible fix:
         add (Choice x1) to the context of a quantified context
     • In the expression: _Left1
       In an equation for ‘_Left4’: _Left4 = _Left1
 -}
 }}}

 expected? (I have `-XNoMonomorphismRestriction` on if that's relevant.)

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


More information about the ghc-tickets mailing list