title: How to use Data.Map.lookup in the context of an Either monad?
body: <p>I'm trying to use Data.Map to map strings to functions. The issue I'm having is that the main error handling in my program uses an Either monad, and <code>Map.lookup</code> will return <code>Maybe ([SomeVal] -&gt; Either ValError SomeVal)</code>. How can I make <code>Map.lookup</code> play nicely with the Either monad in this case?</p>
  
  <pre><code>apply :: String -&gt; [SomeVal] -&gt; Either ValError SomeVal
  apply s args = (Map.lookup s prims) &gt;&gt;= \fn -&gt; fn args
  
  prims :: Map String ([SomeVal] -&gt; Either ValError SomeVal)
  prims = Map.fromList
      [("key", function)
      ,("key2", function2)
      ]
  
  ::&gt; apply "key" [val1, val2, val3]
  </code></pre>