I am running ghci from Terminal.
In the source file I defined
factorial :: Int -> Int factorial n = product [1 .. n]
When I run this, I get the result
factorial 13 = 1932053504 product [1 .. 13] = 6227020800
For any number less than 13, the result is correct. However, for any number greater than or equal to 12, the two results are not consistent.
Also, if I define this function recursively:
factorial' :: Int -> Int factorial' 0 = 1 factorial' (n + 1) = (n + 1) * factorial' n
I'm still getting
factorial' 13 = 1932053504
If you understand what is happening here, that would be very helpful. Thanks
source share