invert 1.0.0.1 → 1.0.0.2
raw patch · 3 files changed
+32/−35 lines, 3 filesdep ~basedep ~criteriondep ~hashablePVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, criterion, hashable, vector
API changes (from Hackage documentation)
- Invert.Reexport: class Hashable a
+ Invert.Reexport: class Eq a => Hashable a
Files
- benchmarks/bench.hs +10/−4
- changelog.md +0/−4
- invert.cabal +22/−27
benchmarks/bench.hs view
@@ -1,22 +1,26 @@-import Criterion.Main-import Criterion.Types+import Criterion.Main (defaultMainWith, defaultConfig, bench, bgroup, whnf, Benchmark)+import Criterion.Types (Config (reportFile)) import qualified Invert as I +sizes :: [Integer] sizes = [100, 500, 2_000, 5_000] :: [Integer] +invertGroup :: String -> I.Strategy Integer Integer -> Benchmark invertGroup name strategy = bgroup name $ fmap (invertBench strategy) sizes +invertBench :: (Show b, Enum b, Num b) => I.Strategy b b -> b -> Benchmark invertBench strategy size = bench (show size) $ let- f = I.function strategy [1 .. size] (* (2 ^ 10))- f' x = sum (foldMap (\e -> f (x ^ e)) [0 .. 10])+ f = I.function strategy [1 .. size] (* (2 ^ (10 :: Integer)))+ f' x = sum (foldMap (\e -> f (x ^ (e :: Integer))) [0 .. 10]) in whnf f' size +groups :: [Benchmark] groups = [ invertGroup "linearSearchLazy" I.linearSearchLazy , invertGroup "linearSearchStrict" I.linearSearchStrict@@ -24,9 +28,11 @@ , invertGroup "hashTable" I.hashTable ] +config :: Config config = defaultConfig { reportFile = Just "bench.html" } +main :: IO () main = defaultMainWith config groups
− changelog.md
@@ -1,4 +0,0 @@-History of the `invert` package:-- - Version 1.0, February 2021, initial release- - Version 1.0.0.1, June 2021, extremely minor documentation changes
invert.cabal view
@@ -1,7 +1,7 @@-cabal-version: 2.0+cabal-version: 3.0 name: invert-version: 1.0.0.1+version: 1.0.0.2 synopsis: Automatically generate a function’s inverse category: Functions @@ -9,7 +9,7 @@ This library deals with computing a function’s inverse. This is, of course, not possible in general, so the applicability of this library comes with some caveats:- .+ * The function’s domain must be enumerable, and preferably rather small. We provide a few suggestions and utilities for how to enumerate the domain.@@ -19,14 +19,13 @@ * The functions for inverting injections, surjections, and bijections require some care to use correctly, because the library does not verify these properties.- .+ The main purpose of this library is to provide documentation and convenience. It does not contain a great quantity of code, so a user hesitant to incur a dependency on the package might well choose only to read and borrow its techniques. build-type: Simple-tested-with: GHC == 9.0.1, GHC == 8.10.3, GHC == 8.8.4, GHC == 8.6.5 author: Chris Martin maintainer: Chris Martin, Julie Moronuki@@ -37,11 +36,19 @@ license: Apache-2.0 license-file: license.txt -extra-source-files: changelog.md--library+common base default-language: Haskell2010 ghc-options: -Wall+ build-depends:+ base ^>= 4.12 || ^>= 4.13 || ^>= 4.14 || ^>= 4.15 || ^>= 4.16+ , containers ^>= 0.6+ , hashable ^>= 1.2.7 || ^>= 1.3 || ^>= 1.4+ , unordered-containers ^>= 0.2.9+ , generic-deriving ^>= 1.14+ , vector ^>= 0.12++library+ import: base exposed-modules: Invert, Invert.Reexport other-modules: Map, Vector hs-source-dirs: src@@ -49,32 +56,20 @@ NoImplicitPrelude , NamedFieldPuns , ExistentialQuantification- build-depends:- base ^>= 4.12 || ^>= 4.13 || ^>= 4.14 || ^>= 4.15- , containers ^>= 0.6- , hashable ^>= 1.2.7 || ^>= 1.3- , unordered-containers ^>= 0.2.9- , generic-deriving ^>= 1.14- , vector ^>= 0.12 test-suite billing-codes-example+ import: base type: exitcode-stdio-1.0- default-language: Haskell2010- ghc-options: -Wall main-is: billing-codes.hs hs-source-dirs: examples- build-depends:- base ^>= 4.12 || ^>= 4.13 || ^>= 4.14 || ^>= 4.15- , invert+ build-depends: invert -benchmark benchmarks- default-language: Haskell2010+benchmark invert-benchmark+ import: base default-extensions: NumericUnderscores type: exitcode-stdio-1.0 hs-source-dirs: benchmarks main-is: bench.hs- ghc-options: -O2 -Wall- Build-Depends:- base ^>= 4.12 || ^>= 4.13 || ^>= 4.14 || ^>= 4.15- , criterion ^>= 1.5- , invert+ ghc-options: -O2+ build-depends: invert+ build-depends: criterion ^>= 1.5