On Thu, Aug 19, 2010 at 6:26 AM, Ivan Lazar Miljenovic <
ivan.miljeno...@gmail.com> wrote:

> I'm trying to update container-classes to duplicate the pre-existing
> classes defined in the Prelude (Functor, etc.) and am trying to get my
> approach on how to have functions/classes that work on types of kind *
> (e.g. Bytestring) as well as kind * -> * (e.g. lists), as my previous
> approach didn't work.
>

This is exactly why the iteratee library provides a newtype wrapper around
ByteString that adds a phantom type.

If I recall correctly, it looks like this (and probably adds some derived
instances):
newtype WrappedByteString a = WBS ByteString

Haskell isn't friendly when it comes to kind polymorphism and I've never
really seen a "solution" for it that I like.

And the above is actually something that may provide a nice addition to
ByteString.  You could track the encoding in the phantom type, potentially.

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

Reply via email to