[Haskell-cafe] Mime / Mail library

Mario Blažević mblazevic at stilo.com
Tue Mar 22 13:57:05 CET 2011


On Sun, Mar 20, 2011 at 10:50 AM, Christopher Done <chrisdone at googlemail.com
> wrote:

> On 20 March 2011 15:05, Pieter Laeremans <pieter at laeremans.org> wrote:
>
>> Hi all,
>>
>> The MIME package that can be found on hackage, uses String as input.
>> Would i be considered better if there would be a version based on Text, or
>> ByteString ?
>>
>
> I think the solution to this problem is a generic `string' package which
> just provides a few classes. The MIME library would export an interface that
> only deals with instances of these classes, and whether you're using Text,
> String, ByteString/Lazy/Char8, ropes, whatever, it's not the library
> writer's concern or assumptions to make.
>
> We already have:
> http://hackage.haskell.org/packages/archive/string-combinators/0.6/doc/html/Data-String-Combinators.html
> <http://hackage.haskell.org/packages/archive/string-combinators/0.6/doc/html/Data-String-Combinators.html>
> Which works on Monoid and IsString, but there needs to be a class like "can
> be read/outputted via IO" and one for read/show/serialize, both of which are
> important for speed.
>
>

One possible extension to the Data-String-Combinators approach can be found
in my new incremental-parser package (
http://hackage.haskell.org/package/incremental-parser-0.1), which I should
soon announce. It relies on three Data.Monoid subclasses, all plain Haskell
98, that allow monoids to be decomposed and parsed. There are instances for
lists, ByteString, and Text. It's a different approach from ListLike,
because it abstracts away the Char type.

Like with any abstraction, though, there is performance cost for some
operations. It could be minimized by adding more defaulted methods to the
FactorialMonoid class, but for the first release I concentrated on what the
parser needed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20110322/082967c5/attachment.htm>


More information about the Haskell-Cafe mailing list