aboutsummaryrefslogtreecommitdiff
path: root/tests/html-tests/tests/Examples.hs
blob: c8c450f1a3f7c62ac2f56fe104d95974170e0f23 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
module Examples where

-- | Fibonacci number of given 'Integer'.
--
-- Examples:
--
-- >>> fib 5
-- 5
-- >>> fib 10
-- 55
--
-- >>> fib 10
-- 55
--
-- One more Example:
--
-- >>> fib 5
-- 5
--
-- One more Example:
--
-- >>> fib 5
-- 5
--
-- Example with an import:
--
-- >>> import Data.Char
-- >>> isSpace 'a'
-- False
--
-- >>> putStrLn "foo\n\nbar"
-- foo
-- <BLANKLINE>
-- bar
--
fib :: Integer -> Integer
fib 0 = 0
fib 1 = 1
fib n = fib (n - 1) + fib (n - 2)