[Haskell-cafe] Restricted type classes

Stephen Tetley stephen.tetley at gmail.com
Sat Sep 4 04:54:16 EDT 2010


On 4 September 2010 08:50, Ivan Lazar Miljenovic
<ivan.miljenovic at gmail.com> wrote:

>>> 3) Am I wasting my time with this?
>>
>> Not at all. Many people want a good containers API, and many people want a
>> cleaned up version of the categorical classes which isn't quite as involved
>> as category-extras. Go for it!
>
> *sigh* I was almost wishing people would say I _was_ wasting my time
> with this... ;-)

Hi Ivan

Okay, I'll bite...

Its good someone is looking into arity versions of Monad, Applicative
etc. I think previously pointed you to Conor McBride's message on the
subject:

http://www.haskell.org/pipermail/haskell-cafe/2008-June/044011.html


But, I don't know that work on this will lead to a better API for
collection classes...

Supposing classes is the way to go, I think there's still a lot of
design work to be done on what the classes should be rather than how
they are implemented. The current design space (ListLike and your
Data.Containers) looks like a factoring of the operations from
Data.List and Data.Sequence, personally I have serious doubts that
this will lead to a nice API. If I was looking at it myself, I'd start
from Chris Okasaki and Ralf Hinze's observations that data structures
have analogies to numerical representations. So, I would try to build
classes upwards from that (monoid is obviously already in place),
rather than design by factoring what List already has. As an example,
I think someone has pointed out on the Cafe that C++ has a container
library following the analogy to numerical representations.

As an aside I thought someone added an implementation of Simon Peyton
Jones's "Bulk Types with Class" to Hackage recently? If they did they
didn't give it a findable description.


Best wishes

Stephen


More information about the Haskell-Cafe mailing list