factorial :: Integer -> Integer factorial 0 = 1factorial n = n * factorial (n - 1) factorial n = if n > 0 then n * factorial (n-1) else 1 factorial n = product [1..n] factorial n = foldl (*) 1 [1..n] factorial = foldr (*) 1 . enumFromTo 1
Standard input is empty
[1 of 1] Compiling Main ( prog.hs, prog.o ) prog.hs:1:0: The function `main' is not defined in module `Main' prog.hs:3:0: Equations for `factorial' have different numbers of arguments prog.hs:3:0-14 prog.hs:12:0-37
Standard output is empty
The brand new service which powers Ideone!
Widget for compiling and running the source code in a web browser!