f n = ft n 1 ft n acc = case n of 0 -> acc _ -> ft (n - 1) (acc * n) main :: IO () main = print ( f 5 )