mirror of
https://github.com/Bodigrim/tasty-bench.git
synced 2024-08-16 20:20:21 +03:00
16 lines
328 B
Haskell
16 lines
328 B
Haskell
module Main (main) where
|
|
|
|
import Test.Tasty.Bench
|
|
|
|
fibo :: Int -> Integer
|
|
fibo n = if n < 2 then toInteger n else fibo (n - 1) + fibo (n - 2)
|
|
|
|
main :: IO ()
|
|
main = defaultMain
|
|
[ bgroup "Fibonacci numbers"
|
|
[ bench "fifth" $ nf fibo 5
|
|
, bench "tenth" $ nf fibo 10
|
|
, bench "twentieth" $ nf fibo 20
|
|
]
|
|
]
|