[prev in list] [next in list] [prev in thread] [next in thread]
List: haskell-cafe
Subject: Re: [Haskell-cafe] Inheritance constraints
From: Gábor_Lehel <illissius () gmail ! com>
Date: 2012-06-07 16:55:11
Message-ID: CAPNUp09R6kPF+fViijNg1aHe7JrWZ+NPFk8_o5exEEDRn9XmDA () mail ! gmail ! com
[Download RAW message or body]
On Thu, Jun 7, 2012 at 1:42 PM, Miguel Mitrofanov <miguelimo38@yandex.ru> wrote:
> Hi cafe!
>
> The ConstraintKinds extension makes it possible to create classes of classes, like this:
>
> class F c where cfmap :: c f => (a -> b) -> f a -> f b
> instance F Functor where cfmap = fmap
> instance F Monad where cfmap = liftM
>
> So, basically we are saying that "c" is a class that has some special properties.
>
> Is it possible to express the property "c is a subclass of a specific class d"? Like
> class F c where Functor f => c f
If I'm understanding you correctly, this is similar to something I
recently filed as a feature request:
http://hackage.haskell.org/trac/ghc/ticket/5927
In the meantime it's possible to emulate it to a limited extent with
the Sub type from the constraints package:
http://hackage.haskell.org/packages/archive/constraints/0.3/doc/html/Data-Constraint.html#g:3
Out of curiosity, do you have any specific use case in mind?
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic