3 ms·
The main point of linked lists in Haskell is that you can compute them lazily. So a Haskell list is more like a python "generator", a callback function that gi
by colonwqbang 4y ago
The main point of linked lists in Haskell is that you can compute them lazily. So a Haskell list is more like a python "generator", a callback function that gives you the next element. This is nice because we don't need a separate interface for generators, streams, ranges, etc.; they are all just lists in Haskell.
If you force computation of a whole list sand save it, the representation in memory would be just a basic linked list. But that's not really recommended as it's a quite inefficient way to store and work with non-tiny amounts data.
There are also true arrays in Haskell which are not very useful due to reasons.
Perhaps the most flexible structures we have are various tree-based array implementations, similar to Clojure's arrays.