[Haskell-cafe] Motion to unify all the string data types

John Lato jwlato at gmail.com
Mon Nov 12 04:21:42 CET 2012

> From: Francesco Mazzoli <f at mazzo.li>
> At Sat, 10 Nov 2012 15:16:30 +0100,
> Alberto G. Corona  wrote:
> > There is a ListLike package, which does this nice abstraction. but I
> don't
> > know if it is ready for and/or enough complete for serious usage.  I?m
> > thinking into using it for the same reasons.
> >
> > Anyone has some experiences to share about it?
> I've used it in the past and it's solid, it's been around for a while and
> the
> original author knows his Haskell.
> Things I don't like:
> * The classes are huge:
>   <
> http://hackage.haskell.org/packages/archive/ListLike/3.1.6/doc/html/Data-ListLike.html#t:ListLike
> >.
>   I'd much rater prefer to have all those utilities functions outside the
> type
>   class, for no particular reason other then the ugliness of the type
> class.

Speaking as the ListLike maintainer, I'd like this too.  But it's difficult
to do so without sacrificing performance.  In some cases, sacrificing *a
lot* of performance.  So they have to be class members.

However, there's no reason ListLike has to remain a single monolithic
class.  I'd prefer an API that's split up into several classes, as was done
in Edison.  Then 'ListLike' itself would just be a type synonym, or
possibly a small type class with the appropriate superclasses.

However this seems like a lot of work for relatively little payoff, which
makes it a low priority for me.

* It defines its own wrappers for `ByteString':
>   <
> http://hackage.haskell.org/packages/archive/ListLike/3.1.6/doc/html/Data-ListLike.html#t:CharString
> >.

The community's view on newtypes is funny.  On the one hand, I see all the
time the claim "Just use a newtype wrapper to write instances for ..."
(e.g. the recent suggestion of 'instance Num a => Num (a,a)'.  On the
other, nobody actually seems to want to use these newtype wrappers.  Maybe
it clutters the code?  I don't know.

I couldn't think of a better way to implement this functionality, patches
would be gratefully accepted.  Anyway, you really shouldn't use these
wrappers unless you're using a ByteString to represent ASCII text.  Which
you shouldn't be doing anyway.  If you're using a ByteString to represent a
sequence of bytes, you needn't ever encounter CharString.

> * It doesn't have instances for `Text', you have to resort to the
>   `listlike-instances' package.

Given that text and vector are both in the Haskell Platform, I wouldn't
object to these instances being rolled into the main ListLike package.  Any
comments on this?

John L.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.haskell.org/pipermail/haskell-cafe/attachments/20121112/9e21f864/attachment.htm>

More information about the Haskell-Cafe mailing list