[Haskell-cafe] Collections

Nicolas Frisby nicolas.frisby at gmail.com
Tue Jun 19 15:23:17 EDT 2007


I don't know where you got the notion that such structures are not
available in Haskell. There are many efficient data structures in the
libraries. Lists are not magical, just popular, natural, and
traditional. Specialized data structures are always important.

Take a look at the Data.* modules in

  http://haskell.org/ghc/docs/latest/html/libraries/

Also see

  http://www.haskell.org/ghc/docs/edison/

There are many references to be found. You may want to cozy up with
this one if you're really interested.

  http://www.cs.cmu.edu/~rwh/theses/okasaki.pdf
  http://books.google.com/books?id=SxPzSTcTalAC

On 6/19/07, Andrew Coppin <andrewcoppin at btinternet.com> wrote:
> When I was at university, we learned a programming language known as
> Smalltalk. I was rather good at it. [Ironically, making "small talk" is
> one of the things I do worst IRL! But anyway, back to the topic...]
>
> In Smalltalk, there is a wide selection of collection types, all with
> different facilities and efficiency trade offs. There is bag, set, list,
> array, ordered list, dictionary, hash table, weak array, etc. A whole
> menagerie of collection types.
>
> However, Haskell only has 1 type of collection: linked lists. (And only
> single-linked at that.) While other "normal" programming languages spend
> huge amounts of effort trying to select exactly the right collection
> type for the task in hand, Haskell programs only ever use linked lists.
>
> Why is that, exactly? Does writing software in Haskell magically change
> the properties of these data structures such that lists become more
> efficient than all the other types? Or is it that other data structures
> are only efficient when used with in-place updates? (The latter
> statement appears to be isomorphic to stating that Haskell programs must
> necessarily be less efficient than impure ones.)
>
> Thoughts?
>
> _______________________________________________
> Haskell-Cafe mailing list
> Haskell-Cafe at haskell.org
> http://www.haskell.org/mailman/listinfo/haskell-cafe
>


More information about the Haskell-Cafe mailing list