Map, Set

2005-06-03 Thread Serge D. Mechveliani
On 2 Jun 2005 S. Alexander Jacobson [EMAIL PROTECTED] writes Any reason the libaries don't define: class HasNull a where null::a-Bool class HasEmpty a where empty::a I find that I sometimes switch between using lists, sets, or tables as my collection type and the forced import

Re: Map, Set

2005-06-03 Thread Jean-Philippe Bernardy
We've been discussing these issues last year on the libraries list, and we reached the concensus that no concensus could be reached ( :) ) on the ultimate class-based collection framewor (tm). Hence we choose to go for concrete implementation of Set and Map types. Please refer to the libraries

Re: addListToFM

2005-06-03 Thread Christian Maeder
Serge D. Mechveliani wrote: I used to apply FiniteMap.addListToFM. Now, what is its best expression in ghc-6.4 ? Is this \ mp pairs - Map.union (Map.fromList pairs) mp ? (the order of the arguments in Map.union is essential). This looks fine to me. best is hard to meet. I'ld

Re: addListToFM

2005-06-03 Thread Jan-Willem Maessen
On Jun 3, 2005, at 7:51 AM, Christian Maeder wrote: Serge D. Mechveliani wrote: I used to apply FiniteMap.addListToFM. Now, what is its best expression in ghc-6.4 ? Is this \ mp pairs - Map.union (Map.fromList pairs) mp ? (the order of the arguments in Map.union is essential). This

Re: Map library

2005-06-03 Thread Jan-Willem Maessen
On Jun 2, 2005, at 10:29 AM, Mario Blazevic wrote: ... 3. The Data.Map looks much better than the FiniteMap library, and its export list is very complete. There are, however, two (or four) more functions that would be really nice to have in there, as they are impossible to write

Re: Set, Map libraries

2005-06-03 Thread Adrian Hey
On Thursday 02 Jun 2005 10:18 am, Jean-Philippe Bernardy wrote: The definition of the Set datatype being data Set a= Tip | Bin {-# UNPACK #-} !Size a !(Set a) !(Set a) type Size = Int It seems your're out of luck when it comes to very large sets. Also, since the

Re: Set, Map libraries

2005-06-03 Thread Adrian Hey
On Saturday 04 Jun 2005 1:33 am, Jan-Willem Maessen wrote: Replace 4 million by, say, 2^32 or 2^64 and I think the point stands. The set must fit in your addressable memory, and can thus be counted by a similar-sized Int. Note also that set implementations which cache the size locally will