Skip to content

Instantly share code, notes, and snippets.

@rootmos

rootmos/fib.hs Secret

Created June 6, 2017 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rootmos/398b1bfac72d1db21e129a4f9f328925 to your computer and use it in GitHub Desktop.
Save rootmos/398b1bfac72d1db21e129a4f9f328925 to your computer and use it in GitHub Desktop.
module Main where
fib :: Int -> Int
fib 1 = 1
fib 2 = 1
fib n = (fib (n - 1)) + (fib (n - 2))
main :: IO ()
main = putStrLn . show $ fib 45
-- > ghc -O -o fib-hs fib.hs; /usr/bin/time ./fib-hs
-- 5.08user 0.00system 0:05.10elapsed 99%CPU (0avgtext+0avgdata 3276maxresident)k
-- 0inputs+0outputs (0major+168minor)pagefaults 0swaps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment