[Haskell-cafe] containers and maps

John Lato jwlato at gmail.com
Thu Aug 13 16:43:43 EDT 2009

On Thu, Aug 13, 2009 at 1:51 PM, Jake McArthur<jake.mcarthur at gmail.com> wrote:
> John Lato wrote:
>> This might work with UVector (I intend to try it this evening); I
>> don't know how well the fusion framework will hold up in class
>> dictionaries.
> Do report back, as I am curious as well.

I have just recently hacked together a small test.  The code is at

The task is to generate a list of 1 million Ints (really 1e6-1), map a
multiply by 2, and check to see if any values equal 0.  The uvector
code is (essentially):

> let res = anyU (== ( 0:: Int)) . mapU (* 2) . enumFromToU 1 $ 1000000

and by itself runs in a small fraction of a second.  Technically the
start and stop values are specified on the command line, but these are
the values I predominantly used.

Here are results for some other modes:

ListLike.map: significantly slower, and runs out of memory (memory
request failed)
ListLike.rigidMap: appears to be the same as using mapU directly
mapReduce:  significantly slower (the 1e6 element test completed after
about an hour), but ran in a very small amount of memory.

It looks like GHC was able to see through the rigidMap function at
least, but I don't know if this would still work with the instance
defined in another file.


More information about the Haskell-Cafe mailing list