projects
/
ghc-hetmet.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
c5a16b730a85535b43ad3d7b1276c8aea6b2b34f
[ghc-hetmet.git]
/
ghc
/
misc
/
examples
/
io
/
io012
/
Main.hs
1
import IO -- 1.3
2
3
import CPUTime
4
5
main =
6
openFile "/dev/null" WriteMode >>= \ h ->
7
hPrint h (nfib 30) >>
8
getCPUTime >>= \ t ->
9
print t
10
11
nfib :: Integer -> Integer
12
nfib n
13
| n <= 1 = 1
14
| otherwise = (n1 + n2 + 1)
15
where
16
n1 = nfib (n-1)
17
n2 = nfib (n-2)