fork download
  1. factorial :: Integer -> Integer
  2.  
  3. factorial 0 = 1
  4. factorial n = n * factorial (n - 1)
  5.  
  6. factorial n = if n > 0 then n * factorial (n-1) else 1
  7.  
  8. factorial n = product [1..n]
  9.  
  10. factorial n = foldl (*) 1 [1..n]
  11.  
  12. factorial = foldr (*) 1 . enumFromTo 1
Compilation error #stdin compilation error #stdout 0s 0KB
stdin
Standard input is empty
compilation info
[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
stdout
Standard output is empty