#5927: A type-level "implies" constraint on Constraints
----------------------------------------+-----------------------------------
    Reporter:  illissius                |       Owner:                  
        Type:  feature request          |      Status:  new             
    Priority:  normal                   |   Milestone:  7.6.1           
   Component:  Compiler (Type checker)  |     Version:  7.4.1           
    Keywords:                           |          Os:  Unknown/Multiple
Architecture:  Unknown/Multiple         |     Failure:  None/Unknown    
  Difficulty:  Unknown                  |    Testcase:                  
   Blockedby:                           |    Blocking:                  
     Related:                           |  
----------------------------------------+-----------------------------------

Comment(by illissius):

 If I'm understanding correctly, the problem could be decomposed into two
 parts?

 - On the one hand you would have an implication constraint between
 Constraints, c => d meaning that c implies d. GHC actually accepts this
 kind of syntax already, but it seems to mean something different (if I
 write {{{foo :: (Ord Int => Eq Int) => Int}}}, it seems to treat this as
 {{{foo :: (Ord Int => Eq Int) -> Int}}} and then expects an {{{Ord Int =>
 Eq Int}}}, whatever that is, as a value-level argument?).

 - On the other hand you would have the quantified constraints feature from
 #2893. In the same way that you could write {{{forall a. Monoid (m a)}}},
 together with the previous feature you could write {{{forall a. c a =>
 Show a}}}.

 If that's the case then, seeing that quantified constraints already has a
 ticket, I'll clarify that this one is referring to the other half. It's
 also more useful by itself for my own use case because quantified
 constraints can be emulated to some extent with GADTs and
 [http://hackage.haskell.org/packages/archive/constraints/0.3.0.1/doc/html/src
 /Data-Constraint-Forall.html#Forall evil hacks], but I don't see any way
 at all to express something like c => d (but correct me if I'm wrong!).

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

_______________________________________________
Glasgow-haskell-bugs mailing list
[email protected]
http://www.haskell.org/mailman/listinfo/glasgow-haskell-bugs

Reply via email to