title: Problem With Haskell: print true if all numbers in a list have a difference of more than 2 between them
body: <p>The haskell code I currently have gives an error:</p>
  <pre><code>main.hs:16:4: error:
      * Couldn't match expected type `Bool' with actual type `[Bool]'
      * In the expression: map alternateMoreThan2 xs
        In an equation for `function':
            function xs = map alternateMoreThan2 xs
     |
  16 |    map alternateMoreThan2 xs
     |    ^^^^^^^^^^^^^^^^^^^^^^^^^
  main.hs:16:27: error:
      * Couldn't match type `Int' with `[Int]'
        Expected type: [[Int]]
          Actual type: [Int]
      * In the second argument of `map', namely `xs'
        In the expression: map alternateMoreThan2 xs
        In an equation for `function':
            function xs = map alternateMoreThan2 xs
     |
  16 |    map alternateMoreThan2 xs
     |                           ^^
  &lt;interactive&gt;:3:1: error:
      * Variable not in scope: main
      * Perhaps you meant `min' (imported from Prelude)
  </code></pre>
  <p>My code is as follows:</p>
  <pre><code>differenceCalc :: Int -&gt; Int -&gt; Int
  differenceCalc x y = abs(x - y)
  
  alternateMoreThan2 :: [Int] -&gt; Bool
  alternateMoreThan2 (x:y:xs:ys)
    | differenceCalc x y &gt; 2 = True
    | otherwise = False
  
  function :: [Int] -&gt; Bool
  function xs =
     map alternateMoreThan2 xs
  
  main :: IO()
  main
    = putStrLn(show(function[24,21,25,17,50,100]))
  </code></pre>
  <p>I have a problem with iterating. It checked the first two pairs before I changed it but stopped at that. Just very confused.
  Thanks.</p>