haskell/criterion

Monad(fail) for 1.4.*

ysangkok opened this issue · 1 comments

The 1.4 branch has a single compilation error on GHC 8.10, I don't know if it is something you still care about, but I thought I'd let yet know. Especially cause I don't know if you get notified when hvr put the base constraint on your package in Hackage. Here is the error:

Criterion/Internal.hs:110:3: error:
    • No instance for (MonadFail Criterion)
        arising from a do statement
        with the failable pattern ‘Measurement _ _ meas’
    • In a stmt of a 'do' block:
        Measurement _ _ meas <- runOne i desc bm
      In the expression:
        do Measurement _ _ meas <- runOne i desc bm
           analyseOne i desc meas
      In an equation for ‘runAndAnalyseOne’:
          runAndAnalyseOne i desc bm
            = do Measurement _ _ meas <- runOne i desc bm
                 analyseOne i desc meas
    |
110 |   Measurement _ _ meas <- runOne i desc bm
    |   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

Feel free to close! I noticed this because Criterion 1.4 is currently used by the UUID package's benchmark and I didn't manage to upgrade it to 1.5 because of some cyclic dependency.

Thanks for the bug report. I am opting not to fix this for two reasons:

  1. Although this may appear to be "a single compilation error", fixing it in criterion-1.5.* actually took a surprising amount of effort. In addition to the commits which added a MonadFail instance (yes, multiple commits), I had to do some subsequent cleanup to ensure that this worked on all supported versions of GHC—see commits f8967b8 and b23e2d7. b23e2d7 in particular is tricky because it depends on a particular interaction between a specific base-compat-batteries version and MonadFailDesugaring, and since criterion-1.4.* has different version bounds on base-compat-batteries than criterion-1.5.* does, it's not clear to me how to backport that commit in a clean way.
  2. criterion-1.4.* is two years old already. Time to upgrade!