fact 0 = 1
fact x = x * fact (x-1)
main = do
putStr "Enter a number to be factorized: "
x <- getLine
putStrLn $ "The answer is " ++ (show . fact . read) x
test
As of March 2020, School of Haskell has been switched to read-only mode.