Containers and strictness continued

Milan Straka fox at ucw.cz
Fri Jul 9 05:56:25 EDT 2010


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.

Cheers,
Milan Straka

PS: I will be unavailable and not reading mail till 19. July 2010.


More information about the Libraries mailing list