<br><br><div class="gmail_quote">On Thu, Aug 19, 2010 at 6:26 AM, Ivan Lazar Miljenovic <span dir="ltr">&lt;<a href="mailto:ivan.miljenovic@gmail.com">ivan.miljenovic@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
I&#39;m trying to update container-classes to duplicate the pre-existing<br>
classes defined in the Prelude (Functor, etc.) and am trying to get my<br>
approach on how to have functions/classes that work on types of kind *<br>
(e.g. Bytestring) as well as kind * -&gt; * (e.g. lists), as my previous<br>
approach didn&#39;t work.<br></blockquote><div><br></div><div>This is exactly why the iteratee library provides a newtype wrapper around ByteString that adds a phantom type.</div><div><br></div><div>If I recall correctly, it looks like this (and probably adds some derived instances):</div>
<div>newtype WrappedByteString a = WBS ByteString</div><div><br></div><div>Haskell isn&#39;t friendly when it comes to kind polymorphism and I&#39;ve never really seen a &quot;solution&quot; for it that I like.</div><div>
<br></div><div>And the above is actually something that may provide a nice addition to ByteString.  You could track the encoding in the phantom type, potentially.</div><div><br></div><div>Jason</div></div>