title: Applying some operation F to each element of a grid? - Haskell
body: <p>I am new to Haskell and have some questions regarding applying a function say <em>f</em> to each element of a grid.</p>
  <p>Grid Type:</p>
  <pre><code>data Grid a = Grid [[a]] deriving (Show, Eq)
  gridG :: Grid a -&gt; [[a]]
  </code></pre>
  <p>Function Definition:</p>
  <pre><code>mapGrid :: (a -&gt; b) -&gt; Grid a -&gt; Grid b
  </code></pre>
  <p>How would I go about doing this? What is throwing me off is that the grid is comprised of List of Lists. Typically you can just apply the map function but throws unexpected types errors.</p>
  <p>For example:</p>
  <pre><code>mapGrid :: (a -&gt; b) -&gt; Grid a -&gt; Grid b
  mapGrid f (Grid g) = map f g
  </code></pre>
  <p>Which throws an expected type of Grid b with actual type [b]</p>