<br><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0pt 0pt 0pt 0.8ex; border-left: 1px solid rgb(204, 204, 204); padding-left: 1ex;">
From: Christopher Done <<a href="mailto:chrisdone@googlemail.com">chrisdone@googlemail.com</a>><br>
<br>
On 20 March 2011 15:05, Pieter Laeremans <<a href="mailto:pieter@laeremans.org">pieter@laeremans.org</a>> wrote:<br>
<br>
> Hi all,<br>
><br>
> The MIME package that can be found on hackage, uses String as input.<br>
> Would i be considered better if there would be a version based on Text, or<br>
> ByteString ?<br>
><br>
<br>
I think the solution to this problem is a generic `string' package which<br>
just provides a few classes. The MIME library would export an interface that<br>
only deals with instances of these classes, and whether you're using Text,<br>
String, ByteString/Lazy/Char8, ropes, whatever, it's not the library<br>
writer's concern or assumptions to make.<br>
<br>
We already have:<br>
<a href="http://hackage.haskell.org/packages/archive/string-combinators/0.6/doc/html/Data-String-Combinators.html" target="_blank">http://hackage.haskell.org/packages/archive/string-combinators/0.6/doc/html/Data-String-Combinators.html</a><br>
<<a href="http://hackage.haskell.org/packages/archive/string-combinators/0.6/doc/html/Data-String-Combinators.html" target="_blank">http://hackage.haskell.org/packages/archive/string-combinators/0.6/doc/html/Data-String-Combinators.html</a>><br>
Which works on Monoid and IsString, but there needs to be a class like "can<br>
be read/outputted via IO" and one for read/show/serialize, both of which are<br>
important for speed.<br>
<br>
Anyone already done work on this? The Data.ByteString modules could export<br>
some instances. It's fair enough that people who need fine-grained speed use<br>
the concrete types and all their special-purposes functions, but in the<br>
general having to choose arbitrarily (often defaulting to String) is a<br>
burden. Can't we standardize on a default set of String classes to use?<br>
<br>
I suppose I could try reducing Data.ByteString's function set into a set of<br>
essential core methods, seeing as the ByteString modules are a very good<br>
spec of what's required for a String type to be completely usable.<br></blockquote><div><br>Data.ListLike (<a href="http://hackage.haskell.org/package/ListLike">http://hackage.haskell.org/package/ListLike</a>) provides this via the "StringLike" class (and StringLikeIO). There are built-in instances for Strings and ByteStrings, with orphan Text instances in <a href="http://hackage.haskell.org/package/listlike-instances">http://hackage.haskell.org/package/listlike-instances</a>.<br>
<br>Probably the StringLike class could be extended to provide more (high-performance) methods, but I don't have a good idea of what's necessary. Suggestions are welcome!<br><br>John L.<br></div></div>