[Haskell-cafe] Byte Histogram
johan.tibell at gmail.com
Sun Feb 6 21:29:59 CET 2011
On Sun, Feb 6, 2011 at 8:48 PM, Andrew Coppin
<andrewcoppin at btinternet.com> wrote:
> In particular, I get strange looks from people in the OOP community when I
> say I'm using a language that doesn't have any abstractions at all for
> dealing polymorphically with containers. In general, it's almost impossible
> to write a Haskell function that will work with a list, an (immutable)
> array, a hash table or a map, polymorphically.
> I guess it's the case that containers has been there so long now that
> changing it would break everything. Still, I find myself hungry for
> something better.
> Than again, the Prelude itself leaves several things to be desired...
I'm working on a new map data type at the moment, which is 2x faster
than Data.Map for all key types I've tried (i.e. Ints, Strings, and
ByteStrings). As part of that work I might try to define a map class
using associated data types. Data.Map can be made an instance of that
class without breaking any old code.
I think one reason we haven't seen a type class for containers is that
it isn't easy to create one using vanilla type classes (see Simon PJ's
paper on the topic.)
More information about the Haskell-Cafe