[Haskell-cafe] Having a connection between kind * and kind * -> *

Jason Dagit dagit at codersbase.com
Thu Aug 19 14:15:49 EDT 2010

On Thu, Aug 19, 2010 at 6:26 AM, Ivan Lazar Miljenovic <
ivan.miljenovic at 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
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.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/haskell-cafe/attachments/20100819/e75770ce/attachment.html

More information about the Haskell-Cafe mailing list