title: Haskell: Can I use a where clause after a block with bind operators (>>=)?
body: <p>I have a very simple question. I'd like to use a where clause after a bloc of code that uses bind operators but I get a compilation error.</p>
  
  <p>Here is a simple example:</p>
  
  <pre><code>main =
      putStrLn "where clause test:" &gt;&gt;
      return [1..10] &gt;&gt;= \list -&gt;
      print list'
          where list' = reverse list -- test1.hs:5:28: Not in scope: `list'
  </code></pre>
  
  <p>I can use a let clause for list' as in</p>
  
  <pre><code>main =
      putStrLn "where clause test:" &gt;&gt;
      return [1..10] &gt;&gt;= \list -&gt;
      let list' = reverse list -- works of course
      in print list'
  </code></pre>
  
  <p>but I'd really like it if I could use a where clause...</p>
  
  <p>I also tried with do notation</p>
  
  <pre><code>main = do
      putStrLn "where clause test:"
      list &lt;- return [1..10]
      print list'
          where list' = reverse list --test3.hs:5:30: Not in scope: `list'
  </code></pre>
  
  <p>Same problem. Can I use a where clause in these circumstances?</p>