haskell / haskell/criterion

please document that `nf` is (contains) an IO action

Open
#274 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
523
Forks
89
PR merge metrics
No merged PRs in 30d

Description

(I am not sure about this but it is a source of confusion in #273 )

We have
```
nf :: NFData b => (a -> b) -> a -> Benchmarkable
```
and `Benchmarkable` is "A pure function or impure action that can be benchmarked." (says the haddock).

So what happens if I write this:
```
import Criterion.Main

main = defaultMain
$ let b = nf length [1 .. 10^7 :: Int ] in
[ bench "1" b
, bench "2" b
, bench "3" b
]
```
I do get the same timings - the value is shared, but the value denotes the action that performs the evaluation. (I think.)

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.