findWithDefault package:nonempty-containers

O(log n). The expression (findWithDefault def k map) returns the value at key k or returns default value def when the key is not in the map.
findWithDefault 'x' 1 (fromList ((5,'a') :| [(3,'b')])) == 'x'
findWithDefault 'x' 5 (fromList ((5,'a') :| [(3,'b')])) == 'a'
O(log n). The expression (findWithDefault def k map) returns the value at key k or returns default value def when the key is not in the map.
findWithDefault 'x' 1 (fromList ((5,'a') :| [(3,'b')])) == 'x'
findWithDefault 'x' 5 (fromList ((5,'a') :| [(3,'b')])) == 'a'