Hello,

I'm working on some code like the following:

> class Chunkable c el | c -> el where
>   cLength :: c -> Int
>   cHead :: c -> Maybe el

I want to be able to map over this type, like this:

>  cMap :: Chunkable c' el' => (el -> el') -> c -> c'

but this isn't quite right.  c' shouldn't be any instance of
Chunkable, it should be the same instance except parameterized over a
different type.  Another approach would be something like:

class (Functor c) => Chunkable c el
...

except that's not right either.  I think c has the wrong kind to be a
Functor instance.

I expect there's something very basic I'm missing.  Could anyone point
in the proper direction of how to do this?  Can this be expressed with
associated types, perhaps?

Thanks,

John Lato
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to