title: How to avoid `case` when handling `Maybe`
body: <p>I am writing interpreter in Haskell and I have map: name_of_function -> defintion of function.</p>
  
  <pre><code>Map String Defun
  </code></pre>
  
  <p>My interpreter monad: </p>
  
  <pre><code>type InterpreterMonad  = StateT (EnvFun, (Stack EnvEval)) (ErrorT String IO ) ()
  </code></pre>
  
  <p>And as you can see "last" monad is <code>ErroT</code>.</p>
  
  <p>Now, when I would like handle calling functions:</p>
  
  <pre><code>   handleFCall :: Stmt -&gt; InterpreterMonad
      handleFCall (VarName name) args =  get &gt;&gt;= \(envFun, contextStack) -&gt; case (Map.lookup (VarName name) envFun) of 
          Nothing -&gt; throwError "Err"
          (Just x) -&gt; DoSthOther
  </code></pre>
  
  <p>And as you can see I have to use <code>case</code>. However I am using <code>&gt;&gt;=</code> so I would like to avoid <code>case of</code> here. But, <code>Map.lookup</code> return <code>Nothing</code> on fail and I would like to add my error message.</p>
  
  <p>I have no experience in Haskell so I don't know how to deal with it . Morever, every criticism to my code is welcome.</p>
  
  <p>Cheers. </p>