Accepting request 912618 from devel:languages:haskell

Automatic submission by obs-autosubmit

OBS-URL: https://build.opensuse.org/request/show/912618
OBS-URL: https://build.opensuse.org/package/show/openSUSE:Factory/ghc-random?expand=0&rev=20
This commit is contained in:
Dominique Leuenberger 2021-08-25 18:57:03 +00:00 committed by Git OBS Bridge
commit 989f5fbbdf
5 changed files with 347 additions and 70 deletions

View File

@ -1,3 +1,94 @@
-------------------------------------------------------------------
Thu Jul 15 16:15:27 UTC 2021 - psimons@suse.com
- Update random to version 1.2.0 revision 6.
Upstream has revised the Cabal build instructions on Hackage.
-------------------------------------------------------------------
Sat Jul 10 14:07:02 UTC 2021 - psimons@suse.com
- Update random to version 1.2.0 revision 5.
# 1.2.0
1. Breaking change which mostly maintains backwards compatibility, see
"Breaking Changes" below.
2. Support for monadic generators e.g. [mwc-random](https://hackage.haskell.org/package/mwc-random).
3. Monadic adapters for pure generators (providing a uniform monadic
interface to pure and monadic generators).
4. Faster in all cases except one by more than x18 (N.B. x18 not 18%) and
some cases (depending on the type) faster by more than x1000 - see
below for benchmarks.
5. Passes a large number of random number test suites:
* [dieharder](http://webhome.phy.duke.edu/~rgb/General/dieharder.php "venerable")
* [TestU01 (SmallCrush, Crush, BigCrush)](http://simul.iro.umontreal.ca/testu01/tu01.html "venerable")
* [PractRand](http://pracrand.sourceforge.net/ "active")
* [gjrand](http://gjrand.sourceforge.net/ "active")
* See [random-quality](https://github.com/tweag/random-quality)
for details on how to do this yourself.
6. Better quality split as judged by these
[tests](https://www.cambridge.org/core/journals/journal-of-functional-programming/article/evaluation-of-splittable-pseudorandom-generators/3EBAA9F14939C5BB5560E32D1A132637). Again
see [random-quality](https://github.com/tweag/random-quality) for
details on how to do this yourself.
7. Unbiased generation of ranges.
8. Updated tests and benchmarks.
9. [Continuous integration](https://travis-ci.org/github/haskell/random).
### Breaking Changes
Version 1.2.0 introduces these breaking changes:
* requires `base >= 4.8` (GHC-7.10)
* `StdGen` is no longer an instance of `Read`
* `randomIO` and `randomRIO` were extracted from the `Random` class into
separate functions
In addition, there may be import clashes with new functions, e.g. `uniform` and
`uniformR`.
### Deprecations
Version 1.2.0 introduces `genWord64`, `genWord32` and similar methods to the
`RandomGen` class. The significantly slower method `next` and its companion
`genRange` are now deprecated.
### Issues Addressed
Issue Number | Description | Comment
--------------|-------------|--------
[25](https://github.com/haskell/random/issues/25) | The seeds generated by split are not independent | Fixed: changed algorithm to SplitMix, which provides a robust split operation
[26](https://github.com/haskell/random/issues/26) | Add Random instances for tuples | Addressed: added `Uniform` instances for up to 6-tuples
[44](https://github.com/haskell/random/issues/44) | Add Random instance for Natural | Addressed: added UniformRange instance for Natural
[51](https://github.com/haskell/random/issues/51) | Very low throughput | Fixed: see benchmarks below
[53](https://github.com/haskell/random/issues/53) | incorrect distribution of randomR for floating-point numbers | (\*)
[55](https://github.com/haskell/random/issues/55) | System/Random.hs:43:1: warning: [-Wtabs] | Fixed: No more tabs
[58](https://github.com/haskell/random/issues/58) | Why does random for Float and Double produce exactly 24 or 53 bits? | (\*)
[59](https://github.com/haskell/random/issues/59) | read :: StdGen fails for strings longer than 6 | Addressed: StdGen is no longer an instance of Read
#### Comments
(\*) 1.2 samples more bits but does not sample every `Float` or
`Double`. There are methods to do this but they have some downsides;
see [here](https://github.com/idontgetoutmuch/random/issues/105) for a
fuller discussion.
## Benchmarks
Here are some benchmarks run on a 3.1 GHz Intel Core i7. The full
benchmarks can be run using e.g. `stack bench`. The benchmarks are
measured in milliseconds per 100,000 generations. In some cases, the
performance is over x1000 times better; the minimum performance
increase for the types listed below is more than x36.
Name | 1.1 Mean | 1.2 Mean
------------|----------|----------
Float | 27.819 | 0.305
Double | 50.644 | 0.328
Integer | 42.332 | 0.332
Word | 40.739 | 0.027
Int | 43.847 | 0.028
Char | 17.009 | 0.462
Bool | 17.542 | 0.027
-------------------------------------------------------------------
Thu Dec 17 12:20:00 UTC 2020 - Ondřej Súkup <mimi.vx@gmail.com>

View File

@ -1,7 +1,7 @@
#
# spec file for package ghc-random
#
# Copyright (c) 2020 SUSE LLC
# Copyright (c) 2021 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -17,23 +17,83 @@
%global pkg_name random
%bcond_with tests
Name: ghc-%{pkg_name}
Version: 1.1
Version: 1.2.0
Release: 0
Summary: Random number library
Summary: Pseudo-random number generation
License: BSD-3-Clause
URL: https://hackage.haskell.org/package/%{pkg_name}
Source0: https://hackage.haskell.org/package/%{pkg_name}-%{version}/%{pkg_name}-%{version}.tar.gz
Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/1.cabal#/%{pkg_name}.cabal
Source1: https://hackage.haskell.org/package/%{pkg_name}-%{version}/revision/6.cabal#/%{pkg_name}.cabal
BuildRequires: ghc-Cabal-devel
BuildRequires: ghc-bytestring-devel
BuildRequires: ghc-deepseq-devel
BuildRequires: ghc-mtl-devel
BuildRequires: ghc-rpm-macros
BuildRequires: ghc-time-devel
BuildRequires: ghc-splitmix-devel
ExcludeArch: %{ix86}
%if %{with tests}
BuildRequires: ghc-containers-devel
BuildRequires: ghc-doctest-devel
BuildRequires: ghc-mwc-random-devel
BuildRequires: ghc-primitive-devel
BuildRequires: ghc-smallcheck-devel
BuildRequires: ghc-tasty-devel
BuildRequires: ghc-tasty-expected-failure-devel
BuildRequires: ghc-tasty-hunit-devel
BuildRequires: ghc-tasty-smallcheck-devel
BuildRequires: ghc-unliftio-devel
BuildRequires: ghc-vector-devel
%endif
%description
This package provides a basic random number generation library, including the
This package provides basic pseudo-random number generation, including the
ability to split random number generators.
== "System.Random": pure pseudo-random number interface
In pure code, use 'System.Random.uniform' and 'System.Random.uniformR' from
"System.Random" to generate pseudo-random numbers with a pure pseudo-random
number generator like 'System.Random.StdGen'.
As an example, here is how you can simulate rolls of a six-sided die using
'System.Random.uniformR':
>>> let roll = uniformR (1, 6) :: RandomGen g => g -> (Word, g) >>> let rolls =
unfoldr (Just . roll) :: RandomGen g => g -> [Word] >>> let pureGen = mkStdGen
42 >>> take 10 (rolls pureGen) :: [Word] [1,1,3,2,4,5,3,4,6,2]
See "System.Random" for more details.
== "System.Random.Stateful": monadic pseudo-random number interface
In monadic code, use 'System.Random.Stateful.uniformM' and
'System.Random.Stateful.uniformRM' from "System.Random.Stateful" to generate
pseudo-random numbers with a monadic pseudo-random number generator, or using a
monadic adapter.
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) :: StatefulGen g m => g -> m Word >>> let
pureGen = mkStdGen 42 >>> runStateGen_ pureGen (replicateM 10 . rollM) ::
[Word] [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.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) ::
StatefulGen g m => g -> m Word >>> monadicGen <- MWC.create >>> replicateM 10
(rollM monadicGen) :: IO [Word] [2,3,6,6,4,4,3,1,5,4]
See "System.Random.Stateful" for more details.
%package devel
Summary: Haskell %{pkg_name} library development files
Requires: %{name} = %{version}-%{release}
@ -54,6 +114,9 @@ cp -p %{SOURCE1} %{pkg_name}.cabal
%install
%ghc_lib_install
%check
%cabal_test
%post devel
%ghc_pkg_recache

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b718a41057e25a3a71df693ab0fe2263d492e759679b3c2fea6ea33b171d3a5a
size 10870

3
random-1.2.0.tar.gz Normal file
View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:e4519cf7c058bfd5bdbe4acc782284acc9e25e74487208619ca83cbcd63fb9de
size 37889

View File

@ -1,71 +1,194 @@
name: random
version: 1.1
x-revision: 1
license: BSD3
license-file: LICENSE
maintainer: carter dot schonwald at google mail dot com
bug-reports: https://github.com/haskell/random/issues
synopsis: random number library
category: System
cabal-version: >=1.10
name: random
version: 1.2.0
x-revision: 6
license: BSD3
license-file: LICENSE
maintainer: core-libraries-committee@haskell.org
bug-reports: https://github.com/haskell/random/issues
synopsis: Pseudo-random number generation
description:
This package provides a basic random number generation
library, including the ability to split random number
generators.
This package provides basic pseudo-random number generation, including the
ability to split random number generators.
.
== "System.Random": pure pseudo-random number interface
.
In pure code, use 'System.Random.uniform' and 'System.Random.uniformR' from
"System.Random" to generate pseudo-random numbers with a pure pseudo-random
number generator like 'System.Random.StdGen'.
.
As an example, here is how you can simulate rolls of a six-sided die using
'System.Random.uniformR':
.
>>> let roll = uniformR (1, 6) :: RandomGen g => g -> (Word, g)
>>> let rolls = unfoldr (Just . roll) :: RandomGen g => g -> [Word]
>>> let pureGen = mkStdGen 42
>>> take 10 (rolls pureGen) :: [Word]
[1,1,3,2,4,5,3,4,6,2]
.
See "System.Random" for more details.
.
== "System.Random.Stateful": monadic pseudo-random number interface
.
In monadic code, use 'System.Random.Stateful.uniformM' and
'System.Random.Stateful.uniformRM' from "System.Random.Stateful" to generate
pseudo-random numbers with a monadic pseudo-random number generator, or
using a monadic adapter.
.
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) :: StatefulGen g m => g -> m Word
>>> let pureGen = mkStdGen 42
>>> runStateGen_ pureGen (replicateM 10 . rollM) :: [Word]
[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.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) :: StatefulGen g m => g -> m Word
>>> monadicGen <- MWC.create
>>> replicateM 10 (rollM monadicGen) :: IO [Word]
[2,3,6,6,4,4,3,1,5,4]
.
See "System.Random.Stateful" for more details.
category: System
build-type: Simple
extra-source-files:
.travis.yml
README.md
CHANGELOG.md
.gitignore
.darcs-boring
build-type: Simple
-- cabal-version 1.8 needed because "the field 'build-depends: random' refers
-- to a library which is defined within the same package"
cabal-version: >= 1.8
Library
exposed-modules:
System.Random
extensions: CPP
GHC-Options: -O2
build-depends: base >= 3 && < 5, time
README.md
CHANGELOG.md
tested-with: GHC == 7.10.2
, GHC == 7.10.3
, GHC == 8.0.2
, GHC == 8.2.2
, GHC == 8.4.3
, GHC == 8.4.4
, GHC == 8.6.3
, GHC == 8.6.4
, GHC == 8.6.5
, GHC == 8.8.1
, GHC == 8.8.2
, GHC == 8.10.1
source-repository head
type: git
location: http://git.haskell.org/packages/random.git
location: https://github.com/haskell/random.git
-- To run the Test-Suite:
-- $ cabal configure --enable-tests
-- $ cabal test --show-details=always --test-options="+RTS -M1M -RTS"
Test-Suite T7936
type: exitcode-stdio-1.0
main-is: T7936.hs
hs-source-dirs: tests
build-depends: base >= 3 && < 5, random
ghc-options: -rtsopts -O2
library
exposed-modules:
System.Random
System.Random.Internal
System.Random.Stateful
Test-Suite TestRandomRs
type: exitcode-stdio-1.0
main-is: TestRandomRs.hs
hs-source-dirs: tests
build-depends: base >= 3 && < 5, random
ghc-options: -rtsopts -O2
-- TODO. Why does the following not work?
--test-options: +RTS -M1M -RTS
hs-source-dirs: src
default-language: Haskell2010
ghc-options:
-Wall
if impl(ghc >= 8.0)
ghc-options:
-Wincomplete-record-updates -Wincomplete-uni-patterns
Test-Suite TestRandomIOs
type: exitcode-stdio-1.0
main-is: TestRandomIOs.hs
hs-source-dirs: tests
build-depends: base >= 3 && < 5, random
ghc-options: -rtsopts -O2
build-depends:
base >=4.8 && <4.16,
bytestring >=0.10.4 && <0.12,
deepseq >=1.1 && <2,
mtl >=2.2 && <2.3,
splitmix >=0.1 && <0.2
if impl(ghc < 8.0)
build-depends:
transformers
test-suite legacy-test
type: exitcode-stdio-1.0
main-is: Legacy.hs
hs-source-dirs: test-legacy
other-modules:
T7936
TestRandomIOs
TestRandomRs
Random1283
RangeTest
default-language: Haskell2010
ghc-options: -with-rtsopts=-M4M
if impl(ghc >= 8.0)
ghc-options:
-Wno-deprecations
build-depends:
base -any,
containers >=0.5 && <0.7,
random -any
test-suite doctests
type: exitcode-stdio-1.0
main-is: doctests.hs
hs-source-dirs: test
default-language: Haskell2010
build-depends:
base -any,
doctest >=0.15 && <0.19,
mwc-random >=0.13 && <0.16,
primitive >=0.6 && <0.8,
random -any,
unliftio >=0.2 && <0.3,
vector >= 0.10 && <0.14
test-suite spec
type: exitcode-stdio-1.0
main-is: Spec.hs
hs-source-dirs: test
other-modules:
Spec.Range
Spec.Run
default-language: Haskell2010
ghc-options: -Wall
build-depends:
base -any,
bytestring -any,
random -any,
smallcheck >=1.2 && <1.3,
tasty >=1.0 && <1.5,
tasty-smallcheck >=0.8 && <0.9,
tasty-expected-failure -any,
tasty-hunit >=0.10 && <0.11
benchmark legacy-bench
type: exitcode-stdio-1.0
main-is: SimpleRNGBench.hs
hs-source-dirs: bench-legacy
other-modules: BinSearch
default-language: Haskell2010
ghc-options:
-Wall -O2 -threaded -rtsopts -with-rtsopts=-N
if impl(ghc >= 8.0)
ghc-options:
-Wno-deprecations
build-depends:
base -any,
random -any,
rdtsc -any,
split >=0.2 && <0.3,
time >=1.4 && <1.11
benchmark bench
type: exitcode-stdio-1.0
main-is: Main.hs
hs-source-dirs: bench
default-language: Haskell2010
ghc-options: -Wall -O2
build-depends:
base -any,
gauge >=0.2.3 && <0.3,
mtl,
random -any,
splitmix >=0.1 && <0.2