Unit tests for Literate Haskell
[ohcount] / test / src_dir / lithask1.lhs
1 Example taken from http://www.haskell.org/onlinereport/literate.html,
2 with additional tripping characters.
3
4    This literate > program > prompts the user for a number
5    >and prints the factorial of that number:
6
7 > main :: IO ()
8
9 > main = do putStr "Enter a number: "
10 >           l <- readLine
11 >           putStr "n!= "
12 >           print (fact (read l))
13           
14   This is the factorial function.
15
16 > fact :: Integer -> Integer
17 > fact 0 = 1
18 > fact n = n * fact (n-1)