From 1eb8357b93ce01152e2d398a729e75a52c7b2153 Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Sun, 5 May 2024 13:48:07 +0300 Subject: [PATCH 01/13] Require to cabal 3.0 --- mwc-random.cabal | 23 +++++++++++++---------- 1 file changed, 13 insertions(+), 10 deletions(-) diff --git a/mwc-random.cabal b/mwc-random.cabal index 88f2be3..3094dca 100644 --- a/mwc-random.cabal +++ b/mwc-random.cabal @@ -1,5 +1,17 @@ +cabal-version: 3.0 +build-type: Simple name: mwc-random version: 0.15.0.2 +license: BSD-2-Clause +license-file: LICENSE +copyright: 2009, 2010, 2011 Bryan O'Sullivan + +author: Bryan O'Sullivan +maintainer: Alexey Khudyakov +homepage: https://github.com/bos/mwc-random +bug-reports: https://github.com/bos/mwc-random/issues + +category: Math, Statistics synopsis: Fast, high quality pseudo random number generation description: This package contains code for generating high quality random @@ -15,16 +27,7 @@ description: convenient API, is faster, and supports more statistical distributions. -license: BSD3 -license-file: LICENSE -homepage: https://github.com/bos/mwc-random -bug-reports: https://github.com/bos/mwc-random/issues -author: Bryan O'Sullivan -maintainer: Bryan O'Sullivan -copyright: 2009, 2010, 2011 Bryan O'Sullivan -category: Math, Statistics -build-type: Simple -cabal-version: >= 1.10 + extra-source-files: changelog.md README.md From 5660421d98473f4fa1d6f43563f2b6866df6930d Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Sun, 5 May 2024 13:50:29 +0300 Subject: [PATCH 02/13] Future-proof library --- System/Random/MWC.hs | 5 +++-- System/Random/MWC/SeedSource.hs | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/System/Random/MWC.hs b/System/Random/MWC.hs index 0efbc1a..726e603 100644 --- a/System/Random/MWC.hs +++ b/System/Random/MWC.hs @@ -1,6 +1,6 @@ {-# LANGUAGE BangPatterns, CPP, DeriveDataTypeable, FlexibleContexts, FlexibleInstances, MultiParamTypeClasses, MagicHash, Rank2Types, - ScopedTypeVariables, TypeFamilies, UnboxedTuples + ScopedTypeVariables, TypeFamilies, UnboxedTuples, TypeOperators #-} -- | -- Module : System.Random.MWC @@ -167,6 +167,7 @@ import Data.IORef (IORef, atomicModifyIORef, newIORef) import Data.Typeable (Typeable) import Data.Vector.Generic (Vector) import Data.Word +import Data.Kind import qualified Data.Vector.Generic as G import qualified Data.Vector.Generic.Mutable as GM import qualified Data.Vector.Unboxed as I @@ -623,7 +624,7 @@ uniform2 f (Gen q) = do -- Type family for fixed size integrals. For signed data types it's -- its unsigned counterpart with same size and for unsigned data types -- it's same type -type family Unsigned a :: * +type family Unsigned a :: Type type instance Unsigned Int8 = Word8 type instance Unsigned Int16 = Word16 diff --git a/System/Random/MWC/SeedSource.hs b/System/Random/MWC/SeedSource.hs index 6018ba0..31b1931 100644 --- a/System/Random/MWC/SeedSource.hs +++ b/System/Random/MWC/SeedSource.hs @@ -30,7 +30,7 @@ import System.IO (IOMode(..), hGetBuf, withBinaryFile) -- Windows system. acquireSeedTime :: IO [Word32] acquireSeedTime = do - c <- (numerator . (%cpuTimePrecision)) `liftM` getCPUTime + c <- (numerator . (% cpuTimePrecision)) `liftM` getCPUTime t <- toRational `liftM` getPOSIXTime let n = fromIntegral (numerator t) :: Word64 return [fromIntegral c, fromIntegral n, fromIntegral (n `shiftR` 32)] From f98be6f5fd8c9ccb9b4766a107499b73ecb03135 Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Sun, 5 May 2024 13:56:08 +0300 Subject: [PATCH 03/13] Allow newer doctests --- mwc-random.cabal | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/mwc-random.cabal b/mwc-random.cabal index 3094dca..6e869b0 100644 --- a/mwc-random.cabal +++ b/mwc-random.cabal @@ -79,7 +79,6 @@ benchmark mwc-bench , mwc-random , random - test-suite mwc-prop-tests type: exitcode-stdio-1.0 hs-source-dirs: tests @@ -106,7 +105,7 @@ test-suite mwc-doctests build-depends: base -any , mwc-random -any - , doctest >=0.15 && <0.20 + , doctest >=0.15 && <0.23 -- , bytestring , primitive From fa4bb5ae4530261534a2ff19330a49648e7a4b20 Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Sun, 5 May 2024 13:59:51 +0300 Subject: [PATCH 04/13] Use correct repository URL --- mwc-random.cabal | 16 ++++++---------- 1 file changed, 6 insertions(+), 10 deletions(-) diff --git a/mwc-random.cabal b/mwc-random.cabal index 6e869b0..073bcc6 100644 --- a/mwc-random.cabal +++ b/mwc-random.cabal @@ -8,8 +8,8 @@ copyright: 2009, 2010, 2011 Bryan O'Sullivan author: Bryan O'Sullivan maintainer: Alexey Khudyakov -homepage: https://github.com/bos/mwc-random -bug-reports: https://github.com/bos/mwc-random/issues +homepage: https://github.com/haskell/mwc-random +bug-reports: https://github.com/haskell/mwc-random/issues category: Math, Statistics synopsis: Fast, high quality pseudo random number generation @@ -40,7 +40,10 @@ tested-with: || ==8.6.5 || ==8.8.3 || ==8.10.1 - , GHCJS ==8.4 + +source-repository head + type: git + location: git://github.com/haskell/mwc-random library default-language: Haskell2010 @@ -58,13 +61,6 @@ library ghc-options: -Wall -funbox-strict-fields -fwarn-tabs -source-repository head - type: git - location: git://github.com/bos/mwc-random - -source-repository head - type: mercurial - location: https://bitbucket.org/bos/mwc-random benchmark mwc-bench From 070673940339871645b4f168aa36e5aebb1f5f32 Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Sun, 5 May 2024 14:02:06 +0300 Subject: [PATCH 05/13] Switch benchmarks to tasty-bench. gauge is not maintained anymore --- bench/Benchmark.hs | 2 +- mwc-random.cabal | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/bench/Benchmark.hs b/bench/Benchmark.hs index 6a844bc..7f6e018 100644 --- a/bench/Benchmark.hs +++ b/bench/Benchmark.hs @@ -2,7 +2,7 @@ import Control.Exception import Control.Monad import Control.Monad.ST -import Gauge.Main +import Test.Tasty.Bench import Data.Int import Data.Word import qualified Data.Vector.Unboxed as U diff --git a/mwc-random.cabal b/mwc-random.cabal index 073bcc6..ac5c030 100644 --- a/mwc-random.cabal +++ b/mwc-random.cabal @@ -70,7 +70,7 @@ benchmark mwc-bench default-language: Haskell2010 build-depends: base < 5 , vector >= 0.11 - , gauge >= 0.2.5 + , tasty-bench >= 0.3 , mersenne-random , mwc-random , random From ca5c5a1df263488cb47798ad749a9f49b270e099 Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Sun, 5 May 2024 14:08:20 +0300 Subject: [PATCH 06/13] Remove defunct CI & remnants of mercurial --- .appveyor.yml | 18 ------------------ .hgignore | 5 ----- .hgtags | 38 -------------------------------------- 3 files changed, 61 deletions(-) delete mode 100644 .appveyor.yml delete mode 100644 .hgignore delete mode 100644 .hgtags diff --git a/.appveyor.yml b/.appveyor.yml deleted file mode 100644 index 7b6a043..0000000 --- a/.appveyor.yml +++ /dev/null @@ -1,18 +0,0 @@ -build: off - -before_test: - # http://help.appveyor.com/discussions/problems/6312-curl-command-not-found - - set PATH=C:\Program Files\Git\mingw64\bin;%PATH% - - curl -sS -o stack.zip -L --insecure http://www.stackage.org/stack/windows-i386 - - 7z x stack.zip stack.exe - -clone_folder: "c:\\stack" -environment: - global: - STACK_ROOT: "c:\\sr" - -test_script: - - stack setup > nul - # The ugly echo "" hack is to avoid complaints about 0 being an invalid file - # descriptor - - echo "" | stack --no-terminal test mwc-random-bench:mwc-prop-tests \ No newline at end of file diff --git a/.hgignore b/.hgignore deleted file mode 100644 index bea5a60..0000000 --- a/.hgignore +++ /dev/null @@ -1,5 +0,0 @@ -^(?:benchmarks/dist|dist)$ -\.(?:aux|eventlog|h[ip]|log|[oa]|orig|prof|ps|swp)$ -~$ -syntax: glob -.\#* diff --git a/.hgtags b/.hgtags deleted file mode 100644 index 3853772..0000000 --- a/.hgtags +++ /dev/null @@ -1,38 +0,0 @@ -00b3f86bf9dd72a1e6057af18e7ca6514f50b284 0.4.1.1 -0875b35d18480666846683ed295926018957036b 0.5.1.3 -3e078fd211d814adbe3b11549e1686396b9ff860 0.4.1 -47bb0bcf7b1da329db82da8e39958003206e74f7 0.5.1.0 -c6e7fbd872c866a08a8458f4fcdd70a3f642aa7b 0.5.1.1 -50c7dc69d1f87b63443c1aaf1a950c812c7d2144 0.5.1.2 -5dab25696615958083a12f01f94c10c2183bc075 0.5.1.4 -7c11c654eeba3dbeb44ff7a3b638ef3c6a10c8d6 0.6.0.0 -80543563333435c78a51575c6a056dc6dc740af5 0.7.0.1 -c6e7fbd872c866a08a8458f4fcdd70a3f642aa7b 0.5.1.1 -45ae16e37f262f39a45d974d3e218e6ae6d3d26a 0.8.0.0 -be4127304f451ba126cef98e3d806105deaaf36b 0.8.0.1 -67f1bbc1490bdd6c5dac770f764d2c9cdbdab9d8 0.8.0.2 -67f1bbc1490bdd6c5dac770f764d2c9cdbdab9d8 0.8.0.2 -28a3a8dcbbf2146a823a79e31334215c14994222 0.8.0.2 -78e34a9a84dae6d29a4b2c7610fe63dc07765fc8 0.8.0.3 -a8d79db3a4adf97868c273a231b72a9827a3680a 0.8.0.4 -986216427670031a305db5544eb7bbdd9fbffe71 0.8.0.5 -1a631d80174f8ad197c1a44fc7d6cb4a93421c0c 0.9.0.0 -71191fcedf2305373c29a1bffdbedd41a7f0d404 0.10.0.0 -af221ff2479f829364d14ab50716426ff67b0bac 0.10.0.1 -e1d6653cb4be57d954ed21005ae06cbe9a6c6b73 0.11.0.0 -e1d6653cb4be57d954ed21005ae06cbe9a6c6b73 0.11.0.0 -2c176f268c27cee741f68c1271c40b676f956a1f 0.11.0.0 -f876b418646a3c4f7e6f5a1bcc482fd25cc13b8a 0.12.0.0 -6d927fbf8e83f59a857a986eff4c2309f5b82b98 0.12.0.1 -c8ef9b6ed671b719e83d33df0354580b4f8fb1f1 0.13.0.0 -dbda280e36a4f5d6ee4f542ece709937881a95d0 0.13.1.1 -4b27557f7467e5753a3da6ddd8a3dfb3483a85f0 0.13.1.2 -e0eebf73fcbe911bfb02c1c175f07e5f8076178f 0.13.2.0 -d47c186eda1c80f1dd7098e861f20de289892c1f 0.13.2.1 -e5acaeb916c79aa8c1ef50127346be271fc78ac7 0.13.2.2 -a033a78c2f33835779866db7dcd6087845c9f5e8 0.13.3.0 -b71f9e27689cf21ed6ad61ec84706ce06f9440db 0.13.3.1 -2b5be7401599dbbda6d20689b6067356e558fa67 0.13.3.2 -ab8886890748bd4f5034ce57b486b5125cb1333b 0.13.4.0 -b2647549015dd978857951f07612855491468839 0.13.5.0 -0b04e85d18b7dcce0e43a98ace4433a1483f3a9b 0.13.6.0 From 69b6be40c2aece042488f3232b4b7e5d75a3e9cc Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Sun, 5 May 2024 14:15:05 +0300 Subject: [PATCH 07/13] Add shim module for using tasty-bench --- bench-time/Bench.hs | 13 +++++++++++++ bench/Benchmark.hs | 6 +++--- mwc-random.cabal | 21 ++++++++++++++------- 3 files changed, 30 insertions(+), 10 deletions(-) create mode 100644 bench-time/Bench.hs diff --git a/bench-time/Bench.hs b/bench-time/Bench.hs new file mode 100644 index 0000000..2eae909 --- /dev/null +++ b/bench-time/Bench.hs @@ -0,0 +1,13 @@ +-- | +-- Here we reexport definitions of tasty-bench +module Bench + ( whnf + , nf + , nfIO + , whnfIO + , bench + , bgroup + , defaultMain + ) where + +import Test.Tasty.Bench diff --git a/bench/Benchmark.hs b/bench/Benchmark.hs index 7f6e018..53726f9 100644 --- a/bench/Benchmark.hs +++ b/bench/Benchmark.hs @@ -1,8 +1,6 @@ {-# LANGUAGE BangPatterns #-} import Control.Exception import Control.Monad -import Control.Monad.ST -import Test.Tasty.Bench import Data.Int import Data.Word import qualified Data.Vector.Unboxed as U @@ -12,12 +10,14 @@ import System.Random.MWC.Distributions import System.Random.MWC.CondensedTable import qualified System.Random.Mersenne as M +import Bench + makeTableUniform :: Int -> CondensedTable U.Vector Int makeTableUniform n = tableFromProbabilities $ U.zip (U.enumFromN 0 n) (U.replicate n (1 / fromIntegral n)) {-# INLINE makeTableUniform #-} - +main :: IO () main = do mwc <- create mtg <- M.newMTGen . Just =<< uniform mwc diff --git a/mwc-random.cabal b/mwc-random.cabal index ac5c030..1f4dd44 100644 --- a/mwc-random.cabal +++ b/mwc-random.cabal @@ -61,20 +61,27 @@ library ghc-options: -Wall -funbox-strict-fields -fwarn-tabs - - -benchmark mwc-bench - type: exitcode-stdio-1.0 - hs-source-dirs: bench - main-is: Benchmark.hs +-- We want to be able to build benchmarks using both tasty-bench and tasty-papi. +-- They have similar API so we just create two shim modules which reexport +-- definitions from corresponding library and pick one in cabal file. +common bench-stanza + ghc-options: -Wall default-language: Haskell2010 build-depends: base < 5 , vector >= 0.11 - , tasty-bench >= 0.3 , mersenne-random , mwc-random , random +benchmark mwc-bench + import: bench-stanza + type: exitcode-stdio-1.0 + hs-source-dirs: bench bench-time + main-is: Benchmark.hs + Other-modules: Bench + build-depends: tasty-bench >= 0.3 + + test-suite mwc-prop-tests type: exitcode-stdio-1.0 hs-source-dirs: tests From 41b8a84ab5147b5ae5aa191a1d040949e8752e72 Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Sun, 5 May 2024 14:19:39 +0300 Subject: [PATCH 08/13] Add PAPI-based benchmarks --- bench-papi/Bench.hs | 13 +++++++++++++ mwc-random.cabal | 17 ++++++++++++++++- 2 files changed, 29 insertions(+), 1 deletion(-) create mode 100644 bench-papi/Bench.hs diff --git a/bench-papi/Bench.hs b/bench-papi/Bench.hs new file mode 100644 index 0000000..b1b748a --- /dev/null +++ b/bench-papi/Bench.hs @@ -0,0 +1,13 @@ +-- | +-- Here we reexport definitions of tasty-bench +module Bench + ( whnf + , nf + , nfIO + , whnfIO + , bench + , bgroup + , defaultMain + ) where + +import Test.Tasty.PAPI diff --git a/mwc-random.cabal b/mwc-random.cabal index 1f4dd44..d0ea123 100644 --- a/mwc-random.cabal +++ b/mwc-random.cabal @@ -45,6 +45,12 @@ source-repository head type: git location: git://github.com/haskell/mwc-random +flag BenchPAPI + Description: Enable building of benchmarks which use instruction counters. + It requires libpapi and only works on Linux so it's protected by flag + Default: False + Manual: True + library default-language: Haskell2010 exposed-modules: System.Random.MWC @@ -79,8 +85,17 @@ benchmark mwc-bench hs-source-dirs: bench bench-time main-is: Benchmark.hs Other-modules: Bench - build-depends: tasty-bench >= 0.3 + build-depends: tasty-bench >= 0.3 +benchmark mwc-bench-papi + import: bench-stanza + type: exitcode-stdio-1.0 + if impl(ghcjs) || !flag(BenchPAPI) || impl(ghc < 8.2) + buildable: False + hs-source-dirs: bench bench-papi + main-is: Benchmark.hs + Other-modules: Bench + build-depends: tasty-papi >= 0.1.2 test-suite mwc-prop-tests type: exitcode-stdio-1.0 From 10dce33f67e4902cb713724699dd33ca294811b9 Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Sun, 5 May 2024 14:24:39 +0300 Subject: [PATCH 09/13] Fix CI and add all recent GHC versions --- .github/workflows/ci.yml | 75 ++++++++++++++++++++++++++-------------- 1 file changed, 49 insertions(+), 26 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b16d2bb..5e17be0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,29 +18,40 @@ jobs: matrix: include: ### -- Linux -- - - { cabal: "3.4", os: ubuntu-latest, ghc: "7.10.3" } - - { cabal: "3.4", os: ubuntu-latest, ghc: "8.0.2" } - - { cabal: "3.4", os: ubuntu-latest, ghc: "8.2.2" } - - { cabal: "3.4", os: ubuntu-latest, ghc: "8.4.4" } - - { cabal: "3.4", os: ubuntu-latest, ghc: "8.6.5" } - - { cabal: "3.4", os: ubuntu-latest, ghc: "8.8.4" } - - { cabal: "3.4", os: ubuntu-latest, ghc: "8.10.7" } - - { cabal: "3.4", os: ubuntu-latest, ghc: "9.0.1" } - - { cabal: "3.6", os: ubuntu-latest, ghc: "9.2.1", skip-bench: "true" } + - { cabal: "3.10", os: ubuntu-latest, ghc: "8.0.2" } + - { cabal: "3.10", os: ubuntu-latest, ghc: "8.2.2" } + - { cabal: "3.10", os: ubuntu-latest, ghc: "8.4.4" } + - { cabal: "3.10", os: ubuntu-latest, ghc: "8.6.5" } + - { cabal: "3.10", os: ubuntu-latest, ghc: "8.8.4" } + - { cabal: "3.10", os: ubuntu-latest, ghc: "8.10.7" } + - { cabal: "3.10", os: ubuntu-latest, ghc: "9.0.2" } + - { cabal: "3.10", os: ubuntu-latest, ghc: "9.2.8" } + - { cabal: "3.10", os: ubuntu-latest, ghc: "9.4.8" } + - { cabal: "3.10", os: ubuntu-latest, ghc: "9.6.5" } + - { cabal: "3.10", os: ubuntu-latest, ghc: "9.6.5" } + - { cabal: "3.10", os: ubuntu-latest, ghc: "9.8.2" } ## -- Win -- - - { cabal: "3.4", os: windows-latest, ghc: "8.4.4" } - - { cabal: "3.4", os: windows-latest, ghc: "8.6.5" } - - { cabal: "3.4", os: windows-latest, ghc: "8.8.4" } - - { cabal: "3.4", os: windows-latest, ghc: "8.10.7" } - - { cabal: "3.4", os: windows-latest, ghc: "9.0.1" } - - { cabal: "3.6", os: windows-latest, ghc: "9.2.1", skip-bench: "true" } + - { cabal: "3.10", os: windows-latest, ghc: "8.4.4" } + - { cabal: "3.10", os: windows-latest, ghc: "8.6.5" } + - { cabal: "3.10", os: windows-latest, ghc: "8.8.4" } + - { cabal: "3.10", os: windows-latest, ghc: "8.10.7" } + - { cabal: "3.10", os: windows-latest, ghc: "9.0.2" } + - { cabal: "3.10", os: windows-latest, ghc: "9.2.8" } + - { cabal: "3.10", os: windows-latest, ghc: "9.4.8" } + - { cabal: "3.10", os: windows-latest, ghc: "9.6.5" } + - { cabal: "3.10", os: windows-latest, ghc: "9.6.5" } + - { cabal: "3.10", os: windows-latest, ghc: "9.8.2" } # MacOS - - { cabal: "3.4", os: macOS-latest, ghc: "8.4.4" } - - { cabal: "3.4", os: macOS-latest, ghc: "8.6.5" } - - { cabal: "3.4", os: macOS-latest, ghc: "8.8.4" } - - { cabal: "3.4", os: macOS-latest, ghc: "8.10.7" } - - { cabal: "3.4", os: macOS-latest, ghc: "9.0.1" } - - { cabal: "3.6", os: macOS-latest, ghc: "9.2.1", skip-bench: "true" } + - { cabal: "3.10", os: macOS-13, ghc: "8.4.4" } + - { cabal: "3.10", os: macOS-13, ghc: "8.6.5" } + - { cabal: "3.10", os: macOS-13, ghc: "8.8.4" } + - { cabal: "3.10", os: macOS-13, ghc: "8.10.7" } + - { cabal: "3.10", os: macOS-13, ghc: "9.0.2" } + - { cabal: "3.10", os: macOS-latest, ghc: "9.2.8" } + - { cabal: "3.10", os: macOS-latest, ghc: "9.4.8" } + - { cabal: "3.10", os: macOS-latest, ghc: "9.6.5" } + - { cabal: "3.10", os: macOS-latest, ghc: "9.6.5" } + - { cabal: "3.10", os: macOS-latest, ghc: "9.8.2" } fail-fast: false steps: @@ -50,21 +61,27 @@ jobs: echo M1 ${{ matrix.ghc }} echo M2 ${{ matrix.skip-bench }} # ---------------- - - uses: actions/checkout@v2 + - uses: actions/checkout@v4 # ---------------- - - uses: haskell/actions/setup@v1 + - uses: haskell-actions/setup@v2 id: setup-haskell-cabal name: Setup Haskell with: ghc-version: ${{ matrix.ghc }} cabal-version: ${{ matrix.cabal }} # ---------------- - - uses: actions/cache@v1 + - uses: actions/cache@v3 name: Cache ~/.cabal/store with: path: ${{ steps.setup-haskell-cabal.outputs.cabal-store }} key: ${{ runner.os }}-${{ matrix.ghc }}--${{ github.Shah }} # ---------------- + - name: "Install PAPI" + run: | + sudo apt-get install -y libpapi-dev + echo FLAG_PAPI=-fBenchPAPI >> "$GITHUB_ENV" + if: matrix.os == 'ubuntu-latest' + # ---------------- - name: Versions run: | cabal -V @@ -87,10 +104,16 @@ jobs: - name: Build run: | if [ "${{ matrix.skip-test }}" == "" ]; then FLAG_TEST=--enable-test; fi - if [ "${{ matrix.skip-bench }}" == "" ]; then FLAG_BENCH=--enable-benchmarks; fi - cabal configure $FLAG_TEST $FLAG_BENCH + if [ "${{ matrix.skip-bench }}" == "" ]; then + FLAG_BENCH="--enable-benchmarks --benchmark-option=-l" + fi + cabal configure $FLAG_TEST $FLAG_BENCH $FLAG_PAPI --haddock-all cabal build all --write-ghc-environment-files=always # ---------------- - name: Test run: | cabal test all + # ---------------- + - name: Bench + run: | + cabal bench all From 70a89de214086f07c0f4bf55abf58d44d958e5f2 Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Sun, 5 May 2024 15:57:32 +0300 Subject: [PATCH 10/13] Disable doctests for older GHC on macs --- mwc-random.cabal | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/mwc-random.cabal b/mwc-random.cabal index d0ea123..98c4826 100644 --- a/mwc-random.cabal +++ b/mwc-random.cabal @@ -120,6 +120,11 @@ test-suite mwc-doctests default-language: Haskell2010 if impl(ghcjs) || impl(ghc < 8.0) Buildable: False + -- Linker on macos prints warnings to console which confuses doctests. + -- We simply disable doctests on ma for older GHC + -- > warning: -single_module is obsolete + if os(darwin) && impl(ghc < 9.6) + buildable: False build-depends: base -any , mwc-random -any From 9182b16e763c7bbbb08d3b14dcdf4b9ef6126bd0 Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Sun, 5 May 2024 15:59:23 +0300 Subject: [PATCH 11/13] Delete unused benchmark --- bench/Quickie.hs | 13 ------------- 1 file changed, 13 deletions(-) delete mode 100644 bench/Quickie.hs diff --git a/bench/Quickie.hs b/bench/Quickie.hs deleted file mode 100644 index 2418b8f..0000000 --- a/bench/Quickie.hs +++ /dev/null @@ -1,13 +0,0 @@ -{-# LANGUAGE BangPatterns #-} -import System.Random.MWC (create, uniform) -import Control.Monad.ST (ST, runST) - -u :: ST s Double -u = do - let last = 1000000 :: Int - gen <- create - let loop !n !i | n == last = return i - | otherwise = uniform gen >>= loop (n+1) - loop 0 0 - -main = print (runST u) From 5ec499b2a59dc877388882f6964db691a0f8c13c Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Sun, 5 May 2024 16:02:05 +0300 Subject: [PATCH 12/13] Update tested-with field --- mwc-random.cabal | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/mwc-random.cabal b/mwc-random.cabal index 98c4826..ecc653f 100644 --- a/mwc-random.cabal +++ b/mwc-random.cabal @@ -33,13 +33,19 @@ extra-source-files: README.md tested-with: - GHC ==7.10.3 - || ==8.0.2 - || ==8.2.2 - || ==8.4.4 - || ==8.6.5 - || ==8.8.3 - || ==8.10.1 + GHC ==8.0.2 + || ==8.2.2 + || ==8.4.4 + || ==8.6.5 + || ==8.8.4 + || ==8.10.7 + || ==9.0.2 + || ==9.2.8 + || ==9.4.8 + || ==9.6.5 + || ==9.6.5 + || ==9.8.2 + source-repository head type: git From 425811c613dcec9329092d00918b09188a88b68a Mon Sep 17 00:00:00 2001 From: Alexey Khudyakov Date: Sun, 5 May 2024 16:02:14 +0300 Subject: [PATCH 13/13] Drop support for 7.10 --- mwc-random.cabal | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/mwc-random.cabal b/mwc-random.cabal index ecc653f..bcd5b3a 100644 --- a/mwc-random.cabal +++ b/mwc-random.cabal @@ -63,7 +63,7 @@ library System.Random.MWC.Distributions System.Random.MWC.CondensedTable System.Random.MWC.SeedSource - build-depends: base >= 4.8 && < 5 + build-depends: base >= 4.9 && < 5 , primitive >= 0.6.2 , random >= 1.2 , time