title: Why is Haskell missing "obvious" Typeclasses
body: <p><strong>Consider the Object-Oriented Languages:</strong></p>
  
  <p>Most people coming from an object-oriented programming background, are familiar with the common and intuitive interfaces in various languages that capture the essence of Java's <a href="http://docs.oracle.com/javase/7/docs/api/java/util/Collections.html"><strong><code>Collection</code></strong></a> &amp; <a href="http://docs.oracle.com/javase/7/docs/api/java/util/List.html"><strong><code>List</code></strong></a> interfaces. <strong><code>Collection</code></strong> refers to a  collection of objects which doesn't necessarily have an natural ordering/indexing. A <strong><code>List</code></strong> is a collection which has a natural ordering/indexing. These interfaces abstract many library data-structures in Java, as do their equivalent interfaces in other languages, and an intimate understanding of these interfaces are required to work effectively with most library data-structures.</p>
  
  <p><strong>Transition to Haskell:</strong></p>
  
  <p>Haskell has a type-class system which acts on types analogously to interfaces on objects. Haskell seems to have a <a href="http://www.haskell.org/wikiupload/d/df/Typeclassopedia-diagram.png">well designed type-class hierarchy</a> with regard to Functors, Applicative, Monads, etc. when the type regard functionality. They obviously want <a href="http://www.haskell.org/haskellwiki/Functor-Applicative-Monad_Proposal">correct and well-abstracted type-classes</a>. Yet when you look at many Haskell's containers (<a href="http://hackage.haskell.org/package/base-4.7.0.1/docs/Data-List.html"><strong><code>List</code></strong></a>,<a href="http://hackage.haskell.org/package/containers-0.2.0.1/docs/Data-Map.html"><strong><code>Map</code></strong></a>,<a href="http://hackage.haskell.org/package/containers-0.5.5.1/docs/Data-Sequence.html"><strong><code>Sequence</code></strong></a>,<a href="http://www.haskell.org/ghc/docs/latest/html/libraries/containers-0.5.5.1/Data-Set.html"><strong><code>Set</code></strong></a>,<a href="https://hackage.haskell.org/package/vector-0.9.1/docs/Data-Vector.html"><strong><code>Vector</code></strong></a>) they almost all have very similar (or identical) functions, yet aren't abstracted through type-classes.</p>
  
  <p><strong>Some Examples:</strong></p>
  
  <ul>
  <li><code>null</code> for testing "emptyness"</li>
  <li><code>length</code><strong>/</strong><code>size</code> for element count</li>
  <li><code>elem</code><strong>/</strong><code>member</code> for set inclusion</li>
  <li><code>empty</code> <em>and/or</em> <code>singleton</code> for default construction</li>
  <li><code>union</code> for set union</li>
  <li><code>(\\)</code><strong>/</strong><code>diff</code> for set difference</li>
  <li><code>(!)</code><strong>/</strong><code>(!!)</code> for unsafe indexing (partial function)</li>
  <li><code>(!?)</code><strong>/</strong><code>lookup</code> for safe indexing (total function)</li>
  </ul>
  
  <p>If I want to use any of the functions above, but I have imported two or more containers I have to start hiding functions from the imported modules, or explicitly import only the necessary functions from the modules, or qualifying the imported modules. But since all the functions provide the same logical functionality, it just seems like a hassle. If the functions were defined from type-classes, and not separately in each module, the compiler's type inference mechanics could resolve this. It would also make switching underlying containers simple as long as they shared the type-classes (ie: lets just use a <code>Sequence</code> instead of <code>List</code> for better random access efficiency).</p>
  
  <p>Why doesn't Haskell have a <strong><code>Collection</code></strong> and/or <strong><code>Indexable</code></strong> type-class(es) to unify &amp; generalize some of these functions?</p>