
On 06.02.2011 23:29, Johan Tibell wrote:
On Sun, Feb 6, 2011 at 8:48 PM, Andrew Coppin
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 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.)
Well Foldable and Traversable provide set of generic operations for containers. Although they are quite limited, containter must be polymorphic (e.g. no IntMap) and parameter must be of any type (e.g. no unboxed vectors) both are still quite useful. Also there is a container-classes package which provide set of type class for containers. [1] http://hackage.haskell.org/package/container-classes