[project @ 1996-01-08 20:28:12 by partain]
[ghc.git] / ghc / misc / examples / io / io012 / Main.hs
1 import LibCPUTime
2
3 main =
4 openFile "/dev/null" WriteMode >>= \ h ->
5 hPutText h (nfib 30) >>
6 getCPUTime >>= \ t ->
7 putText t >>
8 putChar '\n'
9
10 nfib :: Integer -> Integer
11 nfib n
12 | n <= 1 = 1
13 | otherwise = (n1 + n2 + 1)
14 where
15 n1 = nfib (n-1)
16 n2 = nfib (n-2)