title: How can I have a vector that's strict in its values, like a normal type with bangs (!)?
body: <p>Some common <a href="http://johantibell.com/files/haskell-performance-patterns.html#%285%29" rel="noreferrer">performance advice</a> in Haskell is to make fast data structures "spine strict" so that the structure, but not necessarily its contents, is fully evaluated as it is created. This lets us do more work when we insert a value and the structure is in cache as opposed to putting it off until we look a value up.</p>
  
  <p>With a normal data type, like the binary trie from <a href="https://hackage.haskell.org/package/containers/docs/Data-IntMap.html" rel="noreferrer">Data.IntMap</a>, this can be accomplished by making the relevant fields in the data structure strict:</p>
  
  <pre><code>data IntMap a = Bin {- ... -} !(IntMap a) !(IntMap a)
                | {- ... -}
  </code></pre>
  
  <p>(Excerpt from the <a href="https://hackage.haskell.org/package/containers-0.5.6.3/docs/src/Data-IntMap-Base.html#IntMap" rel="noreferrer">Data.IntMap.Base</a> source.)</p>
  
  <p>How can I achieve the same behavior if I want to store the children in a vector rather than directly as fields of <code>Bin</code>?</p>
  
  <pre><code>data IntMap a = Bin {- ... -} (Vector (IntMap a))
                | {- ... -}
  </code></pre>