Debian Codegraph @

tests/inputs/test.hs

raw
1
2 -- This literate program prompts the user for a number
3 -- and prints the factorial of that number:
4
5 {- This is a comment. -}
6 {- This is a comment,
7 too -}
8
9 {-# this is a pragma, COUNT IT -}
10
11 main :: IO ()
12 main = do putStr "Enter a number: "
13 l <- readLine
14 putStr "n!= "
15 print (fact (read l))
16 fact :: Integer -> Integer
17 fact 0 = 1
18 fact n = n * fact (n-1)
19