Hi John,

> In the class I wrote, c has kind * (e.g. [a]), but then I don't see
> how to write a suitable map function. For that, I would want c to
> have kind * -> *. Unfortunately then I don't know to write the
> others.
>
> Would I have to do something with c having kind (* -> *) ?
>
> class Chunkable2 c el where
> cLength :: c el -> Int
> cHead :: c el -> Maybe el
> cMap :: (el -> el') -> c el -> c el'

When c is (* -> *), why do you need el to be a parameter of the
typeclass at all? I.e., would this work for your purposes:

> class Chunkable3 c where
>   cLength :: c el -> Int
>   cHead :: c el -> Maybe el
>   cMap :: (a -> b) -> c a -> c b

> instance Chunkable3 [] where
>     cLength = length
>     cMap = map
>     cHead = ...

Using Functor as a superclass of Chunkable3 works too.

Thanks,
-Brian

check out the rest of the Windows Live™. More than mail–Windows Live™ goes way beyond your inbox. More than messages