8

If we look at the containers package. They have Data.Map.Strict, but there is no equivalent Data.Set.Strict. Would it make sense for it to exist?

Tarrasch
  • 10,199
  • 6
  • 41
  • 57

1 Answers1

11

Set is strict. In a same way as both Map.Lazy and Map.Strict are strict in the key. E.g from the Data.Map.Lazy module:

This module satisfies the following strictness property:

  • Key arguments are evaluated to WHNF

The reason is quite obvious: to make any decisions (i.e. something else than always return EQ) the compare have to evaluate the arguments to at least a WHNF (to separate different constructors in a sum type, e.g.)

phadej
  • 11,947
  • 41
  • 78