Use newtype when a value needs a distinct type around exactly one field. An AssocMap can wrap a list of key-value pairs while separating its representation from the public API. section 5.2.2
Pair the idiom with a module export list: export AssocMap without its constructor, but expose operations such as member, alter, empty, delete, and insert. This prevents callers from constructing invalid duplicate-key maps directly. section 5.2.2
A protected associative map
module Data.AssocMap (AssocMap, member, alter) where newtype AssocMap k v = AssocMap [(k, v)] member :: Eq k => k -> AssocMap k v -> Bool member key (AssocMap xs) = member' key xs empty :: AssocMap k v empty = AssocMap []



