packages feed

benign-timestats (empty) → 0.1.0

raw patch · 2 files changed

+47/−0 lines, 2 filesdep +basedep +benigndep +timestats

Dependencies added: base, benign, timestats

Files

+ benign-timestats.cabal view
@@ -0,0 +1,33 @@+cabal-version: 1.12++-- This file has been generated from package.yaml by hpack version 0.38.0.+--+-- see: https://github.com/sol/hpack++name:           benign-timestats+version:        0.1.0+synopsis:       A Benign backend for the Timestats library+description:    See the Benign library.+homepage:       https://github.com/aspiwack/haskell-benign#readme+bug-reports:    https://github.com/aspiwack/haskell-benign/issues+author:         Arnaud Spiwack+maintainer:     arnaud@spiwack.net+copyright:      MIT+license:        MIT+build-type:     Simple++source-repository head+  type: git+  location: https://github.com/aspiwack/haskell-benign++library+  exposed-modules:+      Benign.TimeStats+  hs-source-dirs:+      src+  ghc-options: -Wall -Wcompat -Wincomplete-record-updates -Wincomplete-uni-patterns -Wnoncanonical-monad-instances -Wredundant-constraints+  build-depends:+      base <4.22+    , benign+    , timestats+  default-language: Haskell2010
+ src/Benign/TimeStats.hs view
@@ -0,0 +1,14 @@+{-# LANGUAGE GHC2021 #-}++module Benign.TimeStats where++import Benign qualified+import Control.Exception+import Debug.TimeStats qualified as TimeStats+import System.IO.Unsafe (unsafePerformIO)++-- | @'measure' label strat thing@ measures, in the style of+-- 'TimeStats.measurePure', of running @strat thing@.+measure :: String -> Benign.Strat a -> a -> a+measure label strat thing = unsafePerformIO $ TimeStats.measureM label $ do Benign.E <- evaluate (strat thing); return thing+{-# NOINLINE measure #-}