fact 0 = 1 fact 1 = 1 fact n | n < 0 = error "Negative factorial!" | otherwise = n * fact (n - 1) #### fact 0 = 1 fact 1 = 1 fact n | n < 0 = error "Negative factorial!" | otherwise = g 1 n where g x 1 = x g x n' = g (x * n') (n' - 1)