title: Heterogeneous types as values of Data.Map
body: <p>I would like to be able to do something like this, which is clearly not permitted.</p>
  
  <pre><code>import qualified Data.Map as Map
  x = Map.fromList [ 
        ("Name",    ["John", "Steve", "Kelly", "Zoe"]), 
        ("Surname", ["Smith", "Lee", "Ng", "White"]), 
        ("Age",     [1, 2, 3, 4]) 
      ]
  </code></pre>
  
  <p>One possible solution is to create a type like this:</p>
  
  <pre><code>data L = LInt [Int] | LString [String]
  
  x = Map.fromList [ 
        ("Name",    LString ["John", "Steve", "Kelly", "Zoe"]),
        ("Surname", LString ["Smith", "Lee", "Ng", "White"]), 
        ("Age",     LInt    [1, 2, 3, 4]) 
      ]
  </code></pre>
  
  <p>which is undesirable. Is there are a better way?</p>
  
  <p>My actual use case:
   Very broadly, I am trying to implement parts of dplyr (<a href="http://cran.r-project.org/web/packages/dplyr/vignettes/introduction.html" rel="nofollow">http://cran.r-project.org/web/packages/dplyr/vignettes/introduction.html</a>), which can be viewed as a "grammar of data". Dplyr has expressions for column and row selection of tabular data as well as grouping and joining of rows, where the number of rows can be in the millions and the number of columns in the hundreds. It's not the data size that concerns me now, but the ability to produce capabilities and workflow similar to that package</p>