[Haskell-cafe] About the ConstraintKinds extension

bob zhang bobzhang1988 at gmail.com
Tue Oct 18 03:17:37 CEST 2011

Hi cafe,
     I have played quite a bit with the ConstraintKinds extension, pretty
     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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20111017/13fa388d/attachment.htm>

More information about the Haskell-Cafe mailing list