title: Haskell, Don't know why this has a *parse error on input ‘if’*
body: <p>This is to take a number, get its factorial and double it, however because of the base case if you input 0 it gives 2 as the answer so in order to bypass it i used an if statement, but get the error
  parse error on input ‘if’. Really appreciate if you guys could help :)</p>
  
  <pre><code>fact :: Int -&gt; Int
  fact 0 = 1
  fact n = n * fact(n-1)
  
  doub :: Int -&gt; Int
  doub r = 2 * r
  
  factorialDouble :: IO()
  factorialDouble = do 
                      putStr "Enter a Value: "
                      x &lt;- getLine
                      let num = (read x) :: Int
                          if (num == 0) then error "factorial of zero is 0"
                              else let y = doub (fact num) 
                                      putStrLn ("the double of factorial of " ++ x ++ " is " ++ (show y))
  </code></pre>