[Haskell-cafe] The difficulty of designing a sequence class

ajb at spamcop.net ajb at spamcop.net
Mon Jul 31 17:33:54 EDT 2006


G'day all.

Quoting Brian Hulley <brianh at metamilk.com>:

> The problem is that some people will be using Data.Edison.Seq at the moment
> and will naturally not want it to change. However I'd suggest that all the
> common operations be factored out into separate classes eg:

While I think the huge typeclass is unfortunate, one of Edison's
greatest strengths is that every sequence supports every sequence
operation.  (The catch, of course, is that the operation may be
inefficient.)

This was a deliberate design decision, and I'd be sorry to see it go.
Many is the time in C++ when I started, say, with a std::stack, then
discovered soon after that I needed to peer at the top few elements
on the stack, only to find that std::stack doesn't support that.

Supporting all operations supports exploratory/agile programming.  You
don't have to decide up front what operations you need to be fast.  You
can discover this as you go.

Yes, this is orthogonal to breaking up the huge typeclass, but I thought
I'd just mention it.

Cheers,
Andrew Bromage


More information about the Haskell-Cafe mailing list