Skip to content

Commit

Permalink
Switch to splitmix-0.1, replace -Weverything with -Wall. Fixup constr…
Browse files Browse the repository at this point in the history
…aints a bit
  • Loading branch information
lehins committed Jun 4, 2020
1 parent 78e0f84 commit 14df799
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 27 deletions.
31 changes: 15 additions & 16 deletions random.cabal
Original file line number Diff line number Diff line change
Expand Up @@ -37,21 +37,21 @@ description:
As an example, here is how you can simulate rolls of a six-sided die using
'System.Random.Stateful.uniformRM':
.
>>> let rollM = uniformRM (1, 6) :: MonadRandom g s m => g s -> m Word8
>>> let rollM = uniformRM (1, 6) :: StatefulGen g s m => g s -> m Word8
>>> let pureGen = mkStdGen 42
>>> runGenState_ pureGen (replicateM 10 . rollM) :: m [Word8]
[1,1,3,2,4,5,3,4,6,2]
.
The monadic adapter 'System.Random.Stateful.runGenState_' is used here to lift
the pure pseudo-random number generator @pureGen@ into the
'System.Random.Stateful.MonadRandom' context.
'System.Random.Stateful.StatefulGen' context.
.
The monadic interface can also be used with existing monadic pseudo-random
number generators. In this example, we use the one provided in the
<https://hackage.haskell.org/package/mwc-random mwc-random> package:
.
>>> import System.Random.MWC as MWC
>>> let rollM = uniformRM (1, 6) :: MonadRandom g s m => g s -> m Word8
>>> let rollM = uniformRM (1, 6) :: StatefulGen g s m => g s -> m Word8
>>> monadicGen <- MWC.create
>>> (replicateM 10 . rollM) monadicGen :: m [Word8]
[2,3,6,6,4,4,3,1,5,4]
Expand Down Expand Up @@ -82,17 +82,16 @@ library

hs-source-dirs: src
default-language: Haskell2010
ghc-options:
-Weverything -Wno-implicit-prelude -Wno-missing-import-lists
-Wno-missing-local-signatures -Wno-redundant-constraints
-Wno-unsafe
ghc-options: -Wall
-Wincomplete-record-updates
-Wincomplete-uni-patterns

build-depends:
base >=4.10 && <5,
bytestring >=0.10 && <0.11,
bytestring >=0.10.4 && <0.11,
deepseq >=1.1 && <2,
mtl >=2.2 && <2.3,
splitmix >=0.0.3 && <0.1
splitmix >=0.1 && <0.2

test-suite legacy-test
type: exitcode-stdio-1.0
Expand All @@ -108,7 +107,7 @@ test-suite legacy-test
default-language: Haskell2010
ghc-options: -with-rtsopts=-M4M -Wno-deprecations
build-depends:
base >=4.10 && <5,
base -any,
containers >=0.5 && <0.7,
random -any

Expand All @@ -118,7 +117,7 @@ test-suite doctests
hs-source-dirs: test
default-language: Haskell2010
build-depends:
base >=4.10 && <5,
base -any,
doctest >=0.15 && <0.17,
mwc-random >=0.13 && <0.15,
primitive >=0.6 && <0.8,
Expand All @@ -136,8 +135,8 @@ test-suite spec
default-language: Haskell2010
ghc-options: -Wall
build-depends:
base >=4.10 && <5,
bytestring >=0.10 && <0.11,
base -any,
bytestring -any,
random -any,
smallcheck >=1.1 && <1.2,
tasty >=1.0 && <1.3,
Expand All @@ -155,7 +154,7 @@ benchmark legacy-bench
-Wall -O2 -threaded -rtsopts -with-rtsopts=-N -Wno-deprecations

build-depends:
base >=4.10 && <5,
base -any,
random -any,
rdtsc -any,
split >=0.2 && <0.3,
Expand All @@ -168,7 +167,7 @@ benchmark bench
default-language: Haskell2010
ghc-options: -Wall -O2
build-depends:
base >=4.10 && <5,
base -any,
gauge >=0.2.3 && <0.3,
random -any,
splitmix >=0.0.3 && <0.1
splitmix >=0.1 && <0.2
4 changes: 1 addition & 3 deletions stack-coveralls.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,5 @@ resolver: lts-14.27
packages:
- .
extra-deps:
- splitmix-0.1@sha256:d50c4d0801a35be7875a040470c09863342514930c82a7d25780a6c2efc4fda9,5249
- rdtsc-1.3.0.1@sha256:0a6e8dc715ba82ad72c7e2b1c2f468999559bec059d50540719a80b00dcc4e66,1557
flags:
splitmix:
random: false
5 changes: 1 addition & 4 deletions stack-old.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ extra-deps:
# In addition, the doctests require 'SMGen' from the splitmix package to
# implement 'Prim'. So far, this is only the case on lehin's fork, so we use
# that.
- splitmix-0.0.4@sha256:fb9bb8b54a2e76c8a021fe5c4c3798047e1f60e168379a1f80693047fe00ad0e,4813
- splitmix-0.1@sha256:d50c4d0801a35be7875a040470c09863342514930c82a7d25780a6c2efc4fda9,5249
- doctest-0.16.2@sha256:2f96e9bbe9aee11b47453c82c24b3dc76cdbb8a2a7c984dfd60b4906d08adf68,6942
- cabal-doctest-1.0.8@sha256:34dff6369d417df2699af4e15f06bc181d495eca9c51efde173deae2053c197c,1491
- rdtsc-1.3.0.1@sha256:0a6e8dc715ba82ad72c7e2b1c2f468999559bec059d50540719a80b00dcc4e66,1557
flags:
splitmix:
random: false
6 changes: 2 additions & 4 deletions stack.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
resolver: lts-15.1
packages:
- .
extra-deps: []
flags:
splitmix:
random: false
extra-deps:
- splitmix-0.1@sha256:d50c4d0801a35be7875a040470c09863342514930c82a7d25780a6c2efc4fda9,5249

0 comments on commit 14df799

Please sign in to comment.