3ebf2035a85d5e9e63d317f9faea077692604625
[ghc-hetmet.git] / ghc / tests / io / should_run / io012.hs
1 -- !!! Test getCPUTime
2
3 import IO
4
5 import CPUTime
6
7 main = do
8     t <- getCPUTime
9     print (nfib 30)
10     t <- getCPUTime
11     print (length (show t)) -- printing the CPU time itself is un-cool if you want to diff the output..
12
13 nfib :: Integer -> Integer
14 nfib n 
15   | n <= 1 = 1
16   | otherwise = (n1 + n2 + 1)
17   where 
18     n1 = nfib (n-1) 
19     n2 = nfib (n-2)