fromList is documented as retaining the last priority and value. But it actually retains the first one. To retain the last one (as documented), the foldr should be changed to foldl'. To retain the first one (as is currently done), the foldr should also be changed to a foldl', but with a different version of insert.
fromList
is documented as retaining the last priority and value. But it actually retains the first one. To retain the last one (as documented), thefoldr
should be changed tofoldl'
. To retain the first one (as is currently done), thefoldr
should also be changed to afoldl'
, but with a different version ofinsert
.