Skip to content

Commit

Permalink
Merge pull request #85 from haskellari/noble
Browse files Browse the repository at this point in the history
Drop support for GHCs prior 8.6.5
  • Loading branch information
phadej authored May 2, 2024
2 parents 1ce6232 + 9a35cc8 commit ad9c0ef
Show file tree
Hide file tree
Showing 9 changed files with 81 additions and 266 deletions.
232 changes: 59 additions & 173 deletions .github/workflows/haskell-ci.yml

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
# 0.1.0.5

- Drop support for GHCs prior 8.6.5

# 0.1.0.4

- Add TestU01 test-suite
Expand Down
11 changes: 2 additions & 9 deletions cabal.haskell-ci
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
branches: master
doctest: <9
docspec: >=7.6
benchmarks: >=7.4 && <9
ghcjs-tests: True
docspec: True
benchmarks: False
apt: hugs libhugs-time-bundled libtestu01-0-dev
head-hackage: False

Expand Down Expand Up @@ -33,8 +31,3 @@ constraint-set bytestring-0.12
constraints: bytestring ^>=0.12
tests: True
run-tests: True

raw-travis:
export CABAL
export HC
if [ ! $GHCJS ]; then (cd ${PKGDIR_splitmix} && sh test-hugs.sh); fi
42 changes: 13 additions & 29 deletions splitmix.cabal
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
cabal-version: >=1.10
name: splitmix
version: 0.1.0.5
x-revision: 1
version: 0.1.1
synopsis: Fast Splittable PRNG
description:
Pure Haskell implementation of SplitMix described in
Expand Down Expand Up @@ -34,16 +33,7 @@ bug-reports: https://github.com/haskellari/splitmix/issues
category: System, Random
build-type: Simple
tested-with:
GHC ==7.0.4
|| ==7.2.2
|| ==7.4.2
|| ==7.6.3
|| ==7.8.4
|| ==7.10.3
|| ==8.0.2
|| ==8.2.2
|| ==8.4.4
|| ==8.6.5
GHC ==8.6.5
|| ==8.8.4
|| ==8.10.4
|| ==9.0.2
Expand All @@ -52,7 +42,6 @@ tested-with:
|| ==9.6.4
|| ==9.8.2
|| ==9.10.1
, GHCJS ==8.4

extra-source-files:
Changelog.md
Expand Down Expand Up @@ -82,8 +71,8 @@ library
-- ghc-options: -fplugin=DumpCore -fplugin-opt DumpCore:core-html

build-depends:
base >=4.3 && <4.21
, deepseq >=1.3.0.0 && <1.6
base >=4.12.0.0 && <4.21
, deepseq >=1.4.4.0 && <1.6

if flag(optimised-mixer)
cpp-options: -DOPTIMISED_MIX32=1
Expand Down Expand Up @@ -121,8 +110,8 @@ benchmark comparison
main-is: Bench.hs
build-depends:
base
, containers >=0.4.2.1 && <0.8
, criterion >=1.1.0.0 && <1.7
, containers >=0.6.0.1 && <0.8
, criterion >=1.6.0.0 && <1.7
, random
, splitmix
, tf-random >=0.5 && <0.6
Expand Down Expand Up @@ -150,9 +139,6 @@ benchmark range
, random
, splitmix

if !impl(ghcjs)
build-depends: clock >=0.8 && <0.9

test-suite examples
type: exitcode-stdio-1.0
default-language: Haskell2010
Expand All @@ -161,7 +147,7 @@ test-suite examples
main-is: Examples.hs
build-depends:
base
, HUnit ==1.3.1.2 || >=1.6.0.0 && <1.7
, HUnit >=1.6.0.0 && <1.7
, splitmix

test-suite splitmix-tests
Expand All @@ -176,10 +162,9 @@ test-suite splitmix-tests

build-depends:
base
, base-compat >=0.11.1 && <0.14
, containers >=0.4.0.0 && <0.8
, HUnit ==1.3.1.2 || >=1.6.0.0 && <1.7
, math-functions ==0.1.7.0 || >=0.3.3.0 && <0.4
, HUnit >=1.6.0.0 && <1.7
, math-functions >=0.3.3.0 && <0.4
, splitmix
, test-framework >=0.8.2.0 && <0.9
, test-framework-hunit >=0.3.0.2 && <0.4
Expand Down Expand Up @@ -213,14 +198,13 @@ test-suite splitmix-dieharder
build-depends:
async >=2.2.1 && <2.3
, base
, base-compat-batteries >=0.10.5 && <0.14
, bytestring >=0.9.1.8 && <0.13
, bytestring >=0.10.8.2 && <0.13
, deepseq
, process >=1.0.1.5 && <1.7
, process >=1.6.0.0 && <1.7
, random
, splitmix
, tf-random >=0.5 && <0.6
, vector >=0.11.0.0 && <0.14
, vector >=0.13.0.0 && <0.14

test-suite splitmix-testu01
if !os(linux)
Expand All @@ -246,5 +230,5 @@ test-suite initialization
main-is: Initialization.hs
build-depends:
base
, HUnit ==1.3.1.2 || >=1.6.0.0 && <1.7
, HUnit >=1.6.0.0 && <1.7
, splitmix
37 changes: 1 addition & 36 deletions src-compat/Data/Bits/Compat.hs
Original file line number Diff line number Diff line change
Expand Up @@ -6,39 +6,4 @@ module Data.Bits.Compat (
countLeadingZeros,
) where

import Data.Bits

#if !MIN_VERSION_base(4,7,0)
#define FiniteBits Bits
#endif

#if !MIN_VERSION_base(4,5,0)
popCount :: Bits a => a -> Int
popCount = go 0
where
go c 0 = c `seq` c
go c w = go (c+1) (w .&. (w - 1)) -- clear the least significant
{-# INLINE popCount #-}
#endif

#if !MIN_VERSION_base(4,7,0)
zeroBits :: Bits a => a
zeroBits = clearBit (bit 0) 0
{-# INLINE zeroBits #-}

finiteBitSize :: Bits a => a -> Int
finiteBitSize = bitSize
{-# INLINE finiteBitSize #-}
#endif

#if !MIN_VERSION_base(4,8,0)
countLeadingZeros :: FiniteBits b => b -> Int
countLeadingZeros x = (w-1) - go (w-1)
where
go i | i < 0 = i -- no bit set
| testBit x i = i
| otherwise = go (i-1)

w = finiteBitSize x
{-# INLINE countLeadingZeros #-}
#endif
import Data.Bits (popCount, zeroBits, finiteBitSize, countLeadingZeros)
8 changes: 1 addition & 7 deletions src/System/Random/SplitMix.hs
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,8 @@
-- (the mixing functions are easily inverted, and two successive outputs
-- suffice to reconstruct the internal state).
--
-- Note: This module supports all GHCs since GHC-7.0.4,
-- but GHC-7.0 and GHC-7.2 have slow implementation, as there
-- are no native 'popCount'.
--
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Trustworthy #-}
#endif
module System.Random.SplitMix (
SMGen,
nextWord64,
Expand Down Expand Up @@ -62,7 +56,7 @@ import System.IO.Unsafe (unsafePerformIO)

import System.Random.SplitMix.Init

#if defined(__HUGS__) || !MIN_VERSION_base(4,8,0)
#if defined(__HUGS__)
import Data.Word (Word)
#endif

Expand Down
8 changes: 1 addition & 7 deletions src/System/Random/SplitMix32.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,8 @@
--
-- You __really don't want to use this one__.
--
-- Note: This module supports all GHCs since GHC-7.0.4,
-- but GHC-7.0 and GHC-7.2 have slow implementation, as there
-- are no native 'popCount'.
--
{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Trustworthy #-}
#endif
module System.Random.SplitMix32 (
SMGen,
nextWord32,
Expand Down Expand Up @@ -46,7 +40,7 @@ import System.IO.Unsafe (unsafePerformIO)

import System.Random.SplitMix.Init

#if defined(__HUGS__) || !MIN_VERSION_base(4,8,0)
#if defined(__HUGS__)
import Data.Word (Word)
#endif

Expand Down
3 changes: 0 additions & 3 deletions tests/Dieharder.hs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,6 @@
{-# LANGUAGE ScopedTypeVariables #-}
module Main (main) where

import Prelude ()
import Prelude.Compat

import Control.Concurrent.QSem
import Control.DeepSeq (force)
import Control.Monad (when)
Expand Down
2 changes: 0 additions & 2 deletions tests/MiniQC.hs
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,6 @@ module MiniQC where
import Control.Monad (ap)
import Data.Int (Int32, Int64)
import Data.Word (Word32, Word64)
import Prelude ()
import Prelude.Compat
import Test.Framework.Providers.API (Test, TestName)
import Test.Framework.Providers.HUnit (testCase)
import Test.HUnit (assertFailure)
Expand Down

0 comments on commit ad9c0ef

Please sign in to comment.