[GHC] #14832: QuantifiedConstraints: Adding to the context causes failure

GHC ghc-devs at haskell.org
Wed Feb 21 18:04:50 UTC 2018


#14832: QuantifiedConstraints: Adding to the context causes failure
-------------------------------------+-------------------------------------
        Reporter:  Iceland_jack      |                Owner:  (none)
            Type:  bug               |               Status:  new
        Priority:  normal            |            Milestone:
       Component:  Compiler          |              Version:  8.5
      Resolution:                    |             Keywords:
                                     |  QuantifiedConstraints wipT2893
Operating System:  Unknown/Multiple  |         Architecture:
                                     |  Unknown/Multiple
 Type of failure:  None/Unknown      |            Test Case:
      Blocked By:                    |             Blocking:
 Related Tickets:                    |  Differential Rev(s):
       Wiki Page:                    |
-------------------------------------+-------------------------------------

Comment (by Iceland_jack):

 Replying to [comment:2 simonpj]:
 > I'm inclined to park this one until we have the basics nailed.

 That's fine, this isn't (doesn't seem to be) a show stopper.

 In this case I can encode these properties as a type class
 (`(:-)`-enriched categories)

 {{{#!hs
 type ConstraintCat ob = ob -> ob -> Constraint

 class ConstraintCategory (cat::ConstraintCat ob) where
   cid  :: ()                 :- cat a a
   comp :: (cat a b, cat b c) :- cat a c

 instance CCategory cat => Category (With cat) where
   id :: forall a. With cat a a
   id = case cid :: () :- cat a a of Dict -> With

   (.) :: forall b c a. With cat b c -> With cat a b -> With cat a c
   With . With = case ccomp :: (cat a b, cat b c) :- cat a c of
     Dict -> With
 }}}

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


More information about the ghc-tickets mailing list