title: Lens access Map Key
body: <p>I have some problems using Lens library to acces Map Data type.</p>
  
  <pre><code>data Card
    = Ferme
    | Boulangerie
  
  data PlayerState = PlayerState {
    _psCards      :: Map Card Int,
    } deriving (Show)
  
  
  data GameState = GameState {
    _gsPlayers      :: [PlayerState]
                   } deriving (Show)
  </code></pre>
  
  <p>I have difficulties accessing the <code>Map</code></p>
  
  <pre><code>step :: (MonadState s m, HasGameState s, MonadIO m) =&gt; m ()
  step = do
      i &lt;- use $ gsPlayers . ix 0 . psCards . ix Ferme
  </code></pre>
  
  <p>with the following error:</p>
  
  <pre><code>    • Could not deduce (Monoid Int) arising from a use of ‘ix’
        from the context: (MonadState s m, HasGameState s, MonadIO m)
          bound by the type signature for:
                     step :: forall s (m :: * -&gt; *).
                             (MonadState s m, HasGameState s, MonadIO m) =&gt;
                             m ()
  </code></pre>
  
  <p>Is this because I use <code>ix</code> with different argument in the same line?</p>