title: Haskell - Function signatures
body: <p>I am having difficulties understanding the issues with implementing certain functions. I have a general data type defined as follow :</p>
  
  <pre><code>import qualified Data.Map.Strict as Map
  data Stuff x = Stuff (Map.Map x [x])
  </code></pre>
  
  <p>When I try to implement a function such as this :</p>
  
  <pre><code>foo :: Ord x =&gt; x -&gt; x -&gt; Stuff x -&gt; Stuff x
  foo a b (Stuff c) = Stuff (Map.insert (a b c))
  </code></pre>
  
  <p>I get an error:</p>
  
  <pre><code>Couldn't match expected type ‘Map.Map x [x]’
              with actual type ‘a0 -&gt; Map.Map k0 a0 -&gt; Map.Map k0 a0’
  </code></pre>
  
  <p>However, when I verify the signature in the Haskell docs:</p>
  
  <blockquote>
    <p>insert :: Ord k => k -> a -> Map k a -> Map k a</p>
  </blockquote>
  
  <p>If it's returning a "Map k a", can't type "a" be a list? How could I turn "a" into "[a]"?</p>