Take the 2-minute tour ×  I would like to use a type that
behaves like a simple list of pairs [(a,b)] that serves as a
dictionary, mapping keys of type a to values of type b, while
maintaining a "user-specified", defined order of keys. (i.e.
just as with ordinary lists - I would like to be able to
"append" an item which is then recognized as the "last
element".) However I would like random access lookup on keys
with better than linear performance, i.e. what Data.Map
provides. One option would be to just maintain an ordinary map
in addition to a list of keys that defines their order:  data
OrderedDict a b = OrderedDict (Map a b) [a]  and then define
append operations, etc. that keep the two key collections in
sync. It seems ugly though to maintain two separate collections
of the same keys. Is there a ready-made data type that already
combines ordered keys with efficient random-access lookup by
key?  share|improve this question Java's LinkedHashMap seems to
do something similar: thread a list of keys through th