title: What's the most idiomatic approach to multi-index collections in Haskell?
body: <p>In C++ and other languages, add-on libraries implement a multi-index container, e.g. <a href="http://www.boost.org/doc/libs/1_47_0/libs/multi_index/doc/index.html" rel="noreferrer">Boost.Multiindex</a>.  That is, a collection that stores one type of value but maintains multiple different indices over those values.  These indices provide for different access methods and sorting behaviors, e.g. map, multimap, set, multiset, array, etc.  Run-time complexity of the multi-index container is generally the sum of the individual indices' complexities.</p>
  
  <p>Is there an equivalent for Haskell or do people compose their own?  Specifically, what is the most idiomatic way to implement a collection of type T with both a set-type of index (T is an instance of <code>Ord</code>) as well as a map-type of index (assume that a key value of type K could be provided for each T, either explicitly or via a function <code>T -&gt; K</code>)?</p>