title: How do I give expressions generic types in a "where" clause?
body: <p><sub><em>(please excuse the horribly contrived example)</em></sub></p>
  
  <p>What I want to do is specify types in the where-clause:</p>
  
  <pre><code>somemap :: (a -&gt; b) -&gt; [a] -&gt; [b]
  somemap f xs = ys
    where
      some = take 5 xs :: [a]
      ys = map f some :: [b]
  </code></pre>
  
  <p>But this causes an error:</p>
  
  <pre><code>*Main&gt; :load file.hs 
  [1 of 1] Compiling Main             ( file.hs, interpreted )
  
  fil.hs:15:18:
      Couldn't match expected type `a1' against inferred type `a'
        `a1' is a rigid type variable bound by
             an expression type signature at file.hs:15:25
        `a' is a rigid type variable bound by
            the type signature for `somemap' at file.hs:12:12
        Expected type: [a1]
        Inferred type: [a]
      In the second argument of `take', namely `xs'
      In the expression: take 5 xs :: [a]
  
  file.hs:16:13:
      Couldn't match expected type `b1' against inferred type `b'
        `b1' is a rigid type variable bound by
             an expression type signature at file.hs:16:24
        `b' is a rigid type variable bound by
            the type signature for `somemap' at file.hs:12:17
      In the first argument of `map', namely `f'
      In the expression: map f some :: [b]
      In the definition of `ys': ys = map f some :: [b]
  Failed, modules loaded: none.
  </code></pre>
  
  <p>Whereas if I just specify concrete types, substituting <code>Int</code> for <code>a</code> and <code>Bool</code> for <code>b</code>, no problem:</p>
  
  <pre><code>somemap :: (Int -&gt; Bool) -&gt; [Int] -&gt; [Bool]
  somemap f xs = ys
    where
      some = take 5 xs :: [Int]
      ys = map f some :: [Bool]
  </code></pre>
  
  <p>So my question is: <strong>How do I specify generic types and type constraints in a where-clause?</strong></p>