-- $Id: fibo.ghc,v 1.4 2001/06/14 23:55:06 doug Exp $ -- http://www.bagley.org/~doug/shootout/ import System(getArgs, getProgName, exitWith, ExitCode(..)) main = do arg <- getArgs case arg of [number] -> putStrLn (show (fib (read number))) _ -> do progname <- getProgName putStrLn ("Usage: " ++ progname ++ " number") exitWith (ExitFailure 1) fib :: Int -> Int fib 0 = 1 fib 1 = 1 fib n = fib (n-2) + fib (n-1)