title: Get Max Number from list
body: <p>I'm trying to get the max number from a list using Maybe &amp; Just  and recursion. I have figured out the recursion part but not able to understand the correct syntax to use</p>
  
  <p><strong>Haskell Code</strong>..</p>
  
  <pre><code>Max :: [Int] -&gt; Maybe Int
  Max [_] = []
  Max (x:xs)
      | x &gt; (Max xs) = Just x
      | otherwise = Max xs
  </code></pre>
  
  <p><strong>Input</strong> </p>
  
  <pre><code>Max [1,2,78]
  Max [-99,-12,-37]
  </code></pre>
  
  <p><strong>Compilation Error message</strong></p>
  
  <pre><code>  *Main&gt; :l max.hs
    [1 of 1] Compiling Main             ( max.hs, interpreted )
  
    max.hs:2:14: error:
  * Couldn't match expected type `Maybe Int' with actual type `[a0]'
  * In the expression: []
    In an equation for `Max': Max [_] = []
   |
   2 | Max [_] = []
   |              ^^
  
   max.hs:4:16: error:
  * Couldn't match expected type `Int' with actual type `Maybe Int'
  * In the second argument of `(&gt;)', namely `(Max xs)'
    In the expression: x &gt; (Max xs)
    In a stmt of a pattern guard for
                   an equation for `Max':
      x &gt; (Max xs)
   |
   4 |         | x &gt; (Max xs) = Just x
   |                ^^^^^^^^^
   Failed, no modules loaded.
  </code></pre>