[Haskell-cafe] Type classes

Johannes Gerer kuerzn at gmail.com
Tue May 28 23:22:22 CEST 2013


Dear Tom,

I really appreciate your help, but If I could ask the perfect question
I probably would already know the answer... My example should not
prove anything, instead they collectively show, that I am missing
something. And it is not the fact, that "pure f does not depend on f."
If, however, this makes all the difference, I have to ask, why was
plausability and looking at the actual definition (not just the types)
not important for the other examples.
But I think my problem lies somewhere else. Maybe all would become
evident, if I knew the rigorous definition of "A is more general than
B" in this context. Especially when A is a class of type, that takes
two arguments (i.e. Unit and Arrow) and B for ones, that takes only
one (like Monad, Pure,..)
Thanks again!
Johannes

On Tue, May 28, 2013 at 11:11 PM, Tom Ellis
<tom-lists-haskell-cafe-2013 at jaguarpaw.co.uk> wrote:
> On Tue, May 28, 2013 at 09:09:48PM +0200, Johannes Gerer wrote:
>> What about these two very simple type classes. Are they equivalent?
> [...]
>> class Pointed f where
>>   pure  :: a -> f a
>>
>> class Unit f where
>>   unit :: f a a
>>
>> newtype UnitPointed f a = UnitPointed f a a
>> instance Unit f => Pointed (UnitPointed f) where
>>   pure f = UnitPointed unit
>>
>> newtype Kleisli f a b = Kleisli (a -> f b)
>> instance Pointed f => Unit (Kleisli f) where
>>   unit = Kleisli pure
>
> This is implausible, since "pure f" does not depend on "f".
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe



More information about the Haskell-Cafe mailing list