Containers and strictness continued
ekmett at gmail.com
Fri Jul 9 10:28:52 EDT 2010
+1 across the board
You may also want to look at adding monadic inserts/adjusts/etc in the sense that there is currently no way to insertWith and extract any information in one pass.
This means a lot of otherwise trivial operations on tries built out of Map/IntMap take twice as long as would be otherwise necessary.
Sent from my iPhone
On Jul 9, 2010, at 5:56 AM, Milan Straka <fox at ucw.cz> wrote:
> Hi all,
> for my work on the containers I need to settle some questions about strictness.
> Thank you very much for your opinions.
> Discussion ends: 23. July 2010.
> 1) Strictness of keys and values in the datatype.
> Currently we have the following strictness flags in the datatypes:
> - IntMap: !key value
> - IntSet: !key
> - Map: !key value
> - Set: key
> I vote for changing Set to store keys also strict.
> Storing values as nonstrict probably makes sense.
> 2) Strictness of keys and values in the method definitions.
> The IntMap.lookup (lookup k t = ... seq k ...) evaluates the given key
> even if it is not needed (when searching empty tree). Some methods are
> more carefull.
> I vote for all IntMap, IntSet, Map and Set methods that are given a key
> value (insert, delete, member, ...) to be strict in the keys. This
> a) would be consistent with 1)
> b) would be a bit more efficient (~5% in the IntMap.lookup case)
> 3) Strict folds
> Currently there are no strict folds.
> I vote for adding strict folds (fold', foldWithKey' when appropriate) to
> all Map, Set, IntMap, IntSet.
> Milan Straka
> PS: I will be unavailable and not reading mail till 19. July 2010.
> Libraries mailing list
> Libraries at haskell.org
More information about the Libraries