osc copypac from project:devel:languages:haskell:ghc-9.6.x package:ghc-random revision:4, using keep-link

OBS-URL: https://build.opensuse.org/package/show/devel:languages:haskell/ghc-random?expand=0&rev=67
This commit is contained in:
Peter Simons 2023-11-10 14:07:20 +00:00 committed by Git OBS Bridge
parent db05921910
commit 79dc766707

View File

@ -1,222 +1,222 @@
cabal-version: >=1.10 cabal-version: >=1.10
name: random name: random
version: 1.2.1.1 version: 1.2.1.1
x-revision: 1 x-revision: 1
license: BSD3 license: BSD3
license-file: LICENSE license-file: LICENSE
maintainer: core-libraries-committee@haskell.org maintainer: core-libraries-committee@haskell.org
bug-reports: https://github.com/haskell/random/issues bug-reports: https://github.com/haskell/random/issues
synopsis: Pseudo-random number generation synopsis: Pseudo-random number generation
description: description:
This package provides basic pseudo-random number generation, including the This package provides basic pseudo-random number generation, including the
ability to split random number generators. ability to split random number generators.
. .
== "System.Random": pure pseudo-random number interface == "System.Random": pure pseudo-random number interface
. .
In pure code, use 'System.Random.uniform' and 'System.Random.uniformR' from In pure code, use 'System.Random.uniform' and 'System.Random.uniformR' from
"System.Random" to generate pseudo-random numbers with a pure pseudo-random "System.Random" to generate pseudo-random numbers with a pure pseudo-random
number generator like 'System.Random.StdGen'. number generator like 'System.Random.StdGen'.
. .
As an example, here is how you can simulate rolls of a six-sided die using As an example, here is how you can simulate rolls of a six-sided die using
'System.Random.uniformR': 'System.Random.uniformR':
. .
>>> let roll = uniformR (1, 6) :: RandomGen g => g -> (Word, g) >>> let roll = uniformR (1, 6) :: RandomGen g => g -> (Word, g)
>>> let rolls = unfoldr (Just . roll) :: RandomGen g => g -> [Word] >>> let rolls = unfoldr (Just . roll) :: RandomGen g => g -> [Word]
>>> let pureGen = mkStdGen 42 >>> let pureGen = mkStdGen 42
>>> take 10 (rolls pureGen) :: [Word] >>> take 10 (rolls pureGen) :: [Word]
[1,1,3,2,4,5,3,4,6,2] [1,1,3,2,4,5,3,4,6,2]
. .
See "System.Random" for more details. See "System.Random" for more details.
. .
== "System.Random.Stateful": monadic pseudo-random number interface == "System.Random.Stateful": monadic pseudo-random number interface
. .
In monadic code, use 'System.Random.Stateful.uniformM' and In monadic code, use 'System.Random.Stateful.uniformM' and
'System.Random.Stateful.uniformRM' from "System.Random.Stateful" to generate 'System.Random.Stateful.uniformRM' from "System.Random.Stateful" to generate
pseudo-random numbers with a monadic pseudo-random number generator, or pseudo-random numbers with a monadic pseudo-random number generator, or
using a monadic adapter. using a monadic adapter.
. .
As an example, here is how you can simulate rolls of a six-sided die using As an example, here is how you can simulate rolls of a six-sided die using
'System.Random.Stateful.uniformRM': 'System.Random.Stateful.uniformRM':
. .
>>> let rollM = uniformRM (1, 6) :: StatefulGen g m => g -> m Word >>> let rollM = uniformRM (1, 6) :: StatefulGen g m => g -> m Word
>>> let pureGen = mkStdGen 42 >>> let pureGen = mkStdGen 42
>>> runStateGen_ pureGen (replicateM 10 . rollM) :: [Word] >>> runStateGen_ pureGen (replicateM 10 . rollM) :: [Word]
[1,1,3,2,4,5,3,4,6,2] [1,1,3,2,4,5,3,4,6,2]
. .
The monadic adapter 'System.Random.Stateful.runStateGen_' is used here to lift The monadic adapter 'System.Random.Stateful.runStateGen_' is used here to lift
the pure pseudo-random number generator @pureGen@ into the the pure pseudo-random number generator @pureGen@ into the
'System.Random.Stateful.StatefulGen' context. 'System.Random.Stateful.StatefulGen' context.
. .
The monadic interface can also be used with existing monadic pseudo-random The monadic interface can also be used with existing monadic pseudo-random
number generators. In this example, we use the one provided in the number generators. In this example, we use the one provided in the
<https://hackage.haskell.org/package/mwc-random mwc-random> package: <https://hackage.haskell.org/package/mwc-random mwc-random> package:
. .
>>> import System.Random.MWC as MWC >>> import System.Random.MWC as MWC
>>> let rollM = uniformRM (1, 6) :: StatefulGen g m => g -> m Word >>> let rollM = uniformRM (1, 6) :: StatefulGen g m => g -> m Word
>>> monadicGen <- MWC.create >>> monadicGen <- MWC.create
>>> replicateM 10 (rollM monadicGen) :: IO [Word] >>> replicateM 10 (rollM monadicGen) :: IO [Word]
[2,3,6,6,4,4,3,1,5,4] [2,3,6,6,4,4,3,1,5,4]
. .
See "System.Random.Stateful" for more details. See "System.Random.Stateful" for more details.
category: System category: System
build-type: Simple build-type: Simple
extra-source-files: extra-source-files:
README.md README.md
CHANGELOG.md CHANGELOG.md
tested-with: GHC == 7.10.2 tested-with: GHC == 7.10.2
, GHC == 7.10.3 , GHC == 7.10.3
, GHC == 8.0.2 , GHC == 8.0.2
, GHC == 8.2.2 , GHC == 8.2.2
, GHC == 8.4.3 , GHC == 8.4.3
, GHC == 8.4.4 , GHC == 8.4.4
, GHC == 8.6.3 , GHC == 8.6.3
, GHC == 8.6.4 , GHC == 8.6.4
, GHC == 8.6.5 , GHC == 8.6.5
, GHC == 8.8.1 , GHC == 8.8.1
, GHC == 8.8.2 , GHC == 8.8.2
, GHC == 8.10.1 , GHC == 8.10.1
source-repository head source-repository head
type: git type: git
location: https://github.com/haskell/random.git location: https://github.com/haskell/random.git
library library
exposed-modules: exposed-modules:
System.Random System.Random
System.Random.Internal System.Random.Internal
System.Random.Stateful System.Random.Stateful
other-modules: other-modules:
System.Random.GFinite System.Random.GFinite
hs-source-dirs: src hs-source-dirs: src
default-language: Haskell2010 default-language: Haskell2010
ghc-options: ghc-options:
-Wall -Wall
if impl(ghc >= 8.0) if impl(ghc >= 8.0)
ghc-options: ghc-options:
-Wincomplete-record-updates -Wincomplete-uni-patterns -Wincomplete-record-updates -Wincomplete-uni-patterns
build-depends: build-depends:
base >=4.8 && <5, base >=4.8 && <5,
bytestring >=0.10.4 && <0.13, bytestring >=0.10.4 && <0.13,
deepseq >=1.1 && <2, deepseq >=1.1 && <2,
mtl >=2.2 && <2.4, mtl >=2.2 && <2.4,
splitmix >=0.1 && <0.2 splitmix >=0.1 && <0.2
if impl(ghc < 8.0) if impl(ghc < 8.0)
build-depends: build-depends:
transformers transformers
test-suite legacy-test test-suite legacy-test
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
main-is: Legacy.hs main-is: Legacy.hs
hs-source-dirs: test-legacy hs-source-dirs: test-legacy
other-modules: other-modules:
T7936 T7936
TestRandomIOs TestRandomIOs
TestRandomRs TestRandomRs
Random1283 Random1283
RangeTest RangeTest
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -with-rtsopts=-M8M ghc-options: -with-rtsopts=-M8M
if impl(ghc >= 8.0) if impl(ghc >= 8.0)
ghc-options: ghc-options:
-Wno-deprecations -Wno-deprecations
build-depends: build-depends:
base, base,
containers >=0.5 && <0.7, containers >=0.5 && <0.7,
random random
test-suite doctests test-suite doctests
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
main-is: doctests.hs main-is: doctests.hs
hs-source-dirs: test hs-source-dirs: test
default-language: Haskell2010 default-language: Haskell2010
build-depends: build-depends:
base, base,
doctest >=0.15 && <0.21 doctest >=0.15 && <0.21
if impl(ghc >= 8.2) && impl(ghc < 8.10) if impl(ghc >= 8.2) && impl(ghc < 8.10)
build-depends: build-depends:
mwc-random >=0.13 && <0.16, mwc-random >=0.13 && <0.16,
primitive >=0.6 && <0.8, primitive >=0.6 && <0.8,
random, random,
stm, stm,
unliftio >=0.2 && <0.3, unliftio >=0.2 && <0.3,
vector >= 0.10 && <0.14 vector >= 0.10 && <0.14
test-suite spec test-suite spec
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
main-is: Spec.hs main-is: Spec.hs
hs-source-dirs: test hs-source-dirs: test
other-modules: other-modules:
Spec.Range Spec.Range
Spec.Run Spec.Run
Spec.Stateful Spec.Stateful
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -Wall ghc-options: -Wall
build-depends: build-depends:
base, base,
bytestring, bytestring,
random, random,
smallcheck >=1.2 && <1.3, smallcheck >=1.2 && <1.3,
stm, stm,
tasty >=1.0 && <1.5, tasty >=1.0 && <1.5,
tasty-smallcheck >=0.8 && <0.9, tasty-smallcheck >=0.8 && <0.9,
tasty-hunit >=0.10 && <0.11, tasty-hunit >=0.10 && <0.11,
transformers transformers
-- Note. Fails when compiled with coverage: -- Note. Fails when compiled with coverage:
-- https://github.com/haskell/random/issues/107 -- https://github.com/haskell/random/issues/107
test-suite spec-inspection test-suite spec-inspection
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
main-is: Spec.hs main-is: Spec.hs
hs-source-dirs: test-inspection hs-source-dirs: test-inspection
build-depends: build-depends:
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -Wall ghc-options: -Wall
build-depends: build-depends:
base, base,
random, random,
tasty >=1.0 && <1.5 tasty >=1.0 && <1.5
if impl(ghc >= 8.0) if impl(ghc >= 8.0)
build-depends: build-depends:
tasty-inspection-testing tasty-inspection-testing
other-modules: other-modules:
Spec.Inspection Spec.Inspection
benchmark legacy-bench benchmark legacy-bench
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
main-is: SimpleRNGBench.hs main-is: SimpleRNGBench.hs
hs-source-dirs: bench-legacy hs-source-dirs: bench-legacy
other-modules: BinSearch other-modules: BinSearch
default-language: Haskell2010 default-language: Haskell2010
ghc-options: ghc-options:
-Wall -O2 -threaded -rtsopts -with-rtsopts=-N -Wall -O2 -threaded -rtsopts -with-rtsopts=-N
if impl(ghc >= 8.0) if impl(ghc >= 8.0)
ghc-options: ghc-options:
-Wno-deprecations -Wno-deprecations
build-depends: build-depends:
base, base,
random, random,
rdtsc, rdtsc,
split >=0.2 && <0.3, split >=0.2 && <0.3,
time >=1.4 && <1.13 time >=1.4 && <1.13
benchmark bench benchmark bench
type: exitcode-stdio-1.0 type: exitcode-stdio-1.0
main-is: Main.hs main-is: Main.hs
hs-source-dirs: bench hs-source-dirs: bench
default-language: Haskell2010 default-language: Haskell2010
ghc-options: -Wall -O2 ghc-options: -Wall -O2
build-depends: build-depends:
base, base,
mtl, mtl,
primitive >= 0.7.1, primitive >= 0.7.1,
random, random,
splitmix >=0.1 && <0.2, splitmix >=0.1 && <0.2,
tasty-bench tasty-bench