About the ConstraintKinds extension

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

About the ConstraintKinds extension

bob zhang

Hi cafe,
     I have played quite a bit with the ConstraintKinds extension, pretty cool.
     But I found a problem which I thought would be made better, plz correct me if I am wrong
     
     take a contrived example,      
     class C B => B a where 
     here B :: * -> Constraint,  I think this definition is reasonable, since B does not appears in the 
     first position of the context.
   
     Previously, we require acyclic class declarations since we don't have ConstraintKinds extension
     but now since type class could be abstracted, I think the definition above should be ok.
      
     the ghc-manual cited the program below is valid
class C a where {
    op :: D b => a -> b -> b
  }
 
class C a => D a where { ... }

I think there are no reasons to reject
class C B => B where (and this style is pretty useful in some cases)
...
B :: * -> Constraint
C :: (*->Constraint) -> Constraint

Any comments are welcome
 
     
--
Best, bob

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe
Reply | Threaded
Open this post in threaded view
|

Re: About the ConstraintKinds extension

Max Bolingbroke-2
On 18 October 2011 02:17, bob zhang <[hidden email]> wrote:
>      But I found a problem which I thought would be made better, plz correct
> me if I am wrong

For those who only subscribe to Haskell-Cafe, Bob posted a very
similar thread to ghc-users, which I replied to here with a suggestion
for how we could relax the superclass-cycle check:

http://thread.gmane.org/gmane.comp.lang.haskell.glasgow.user/20828/focus=20829

Max

_______________________________________________
Haskell-Cafe mailing list
[hidden email]
http://www.haskell.org/mailman/listinfo/haskell-cafe