Skip to content

Commit 9ebe1e4

Browse files
author
Nicolas Mattia
committed
Export analysis related functions
1 parent 2756ec7 commit 9ebe1e4

File tree

3 files changed

+15
-6
lines changed

3 files changed

+15
-6
lines changed

examples/end-to-end-benchmarks.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ benchmarks =
2020
main :: IO ()
2121
main = defaultMainWith config "hyperion-example-end-to-end" benchmarks
2222
where
23-
config = defaultConfig
23+
config = defaultConfigMonoid
2424
{ configMonoidSamplingStrategy =
2525
pure $ timeBound (fromSeconds 5) (repeat 10)
2626
}

src/Hyperion/Main.hs

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,15 @@
88
module Hyperion.Main
99
( defaultMain
1010
, Mode(..)
11+
, Config(..)
1112
, ConfigMonoid(..)
1213
, ReportOutput(..)
1314
, nullOutputPath
1415
, defaultConfig
16+
, defaultConfigMonoid
1517
, defaultMainWith
18+
, doAnalyze
19+
, doRun
1620
) where
1721

1822
import Control.Applicative
@@ -178,8 +182,11 @@ nullOutputPath = "nul"
178182
nullOutputPath = "/dev/null"
179183
#endif
180184

181-
defaultConfig :: ConfigMonoid
182-
defaultConfig = mempty
185+
defaultConfigMonoid :: ConfigMonoid
186+
defaultConfigMonoid = mempty
187+
188+
defaultConfig :: Config
189+
defaultConfig = configFromMonoid defaultConfigMonoid
183190

184191
data DuplicateIdentifiers a = DuplicateIdentifiers [a]
185192
instance (Show a, Typeable a) => Exception (DuplicateIdentifiers a)
@@ -315,4 +322,4 @@ defaultMain
315322
:: String -- ^ Package name, user provided.
316323
-> [Benchmark] -- ^ Benchmarks to be run.
317324
-> IO ()
318-
defaultMain = defaultMainWith defaultConfig
325+
defaultMain = defaultMainWith defaultConfigMonoid

tests/Hyperion/MainSpec.hs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,10 @@ spec = do
1515
it "checks for duplicate identifiers" $ property $ \b ->
1616
length (b^..identifiers) /= length (group (sort (b^..identifiers))) ==>
1717
expectFailure $ monadicIO $ run $
18-
defaultMainWith defaultConfig{configMonoidMode = return Run} "spec" [b]
18+
defaultMainWith
19+
defaultConfigMonoid{configMonoidMode = return Run} "spec" [b]
1920
it "Analyzes uniquely identified benchmarks" $ property $ \b ->
2021
length (b^..identifiers) == length (group (sort (b^..identifiers))) ==>
2122
monadicIO $ run $
22-
defaultMainWith defaultConfig{configMonoidReportOutputs = [ReportJson nullOutputPath]} "specs" [b]
23+
defaultMainWith
24+
defaultConfigMonoid{configMonoidReportOutputs = [ReportJson nullOutputPath]} "specs" [b]

0 commit comments

Comments
 (0)