diff options
author | CoprDistGit <infra@openeuler.org> | 2023-10-26 23:10:13 +0000 |
---|---|---|
committer | CoprDistGit <infra@openeuler.org> | 2023-10-26 23:10:13 +0000 |
commit | 359b96dc9f46147d255a2bbfd253d54e00e92a4d (patch) | |
tree | 0ecee9434e551a586780ce8f793768a1bf7330ef | |
parent | 8354e3c2ac65e8f76e3db8485941f84e0e9448c9 (diff) |
automatic import of ghc-randomopeneuler23.09
-rw-r--r-- | .gitignore | 1 | ||||
-rw-r--r-- | ghc-random.spec | 149 | ||||
-rw-r--r-- | sources | 1 |
3 files changed, 151 insertions, 0 deletions
@@ -0,0 +1 @@ +/random-1.2.1.1.tar.gz diff --git a/ghc-random.spec b/ghc-random.spec new file mode 100644 index 0000000..b94e5c4 --- /dev/null +++ b/ghc-random.spec @@ -0,0 +1,149 @@ +%global pkg_name random +%global pkgver %{pkg_name}-%{version} +%bcond_with tests + +Name: ghc-%{pkg_name} +Version: 1.2.1.1 +Release: 1 +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 +BuildRequires: ghc-Cabal-devel +BuildRequires: ghc-base-devel +BuildRequires: ghc-base-prof +BuildRequires: ghc-bytestring-devel +BuildRequires: ghc-bytestring-prof +BuildRequires: ghc-deepseq-devel +BuildRequires: ghc-deepseq-prof +BuildRequires: ghc-mtl-devel +BuildRequires: ghc-mtl-prof +BuildRequires: ghc-rpm-macros +BuildRequires: ghc-splitmix-devel +BuildRequires: ghc-splitmix-prof +ExcludeArch: %{ix86} +%if %{with tests} +BuildRequires: ghc-containers-devel +BuildRequires: ghc-containers-prof +BuildRequires: ghc-doctest-devel +BuildRequires: ghc-doctest-prof +BuildRequires: ghc-smallcheck-devel +BuildRequires: ghc-smallcheck-prof +BuildRequires: ghc-stm-devel +BuildRequires: ghc-stm-prof +BuildRequires: ghc-tasty-devel +BuildRequires: ghc-tasty-hunit-devel +BuildRequires: ghc-tasty-hunit-prof +BuildRequires: ghc-tasty-inspection-testing-devel +BuildRequires: ghc-tasty-inspection-testing-prof +BuildRequires: ghc-tasty-prof +BuildRequires: ghc-tasty-smallcheck-devel +BuildRequires: ghc-tasty-smallcheck-prof +BuildRequires: ghc-transformers-devel +BuildRequires: ghc-transformers-prof +%endif + +%description +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.runStateGen_' 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} +Requires: ghc-compiler = %{ghc_version} +Requires(post): ghc-compiler = %{ghc_version} +Requires(postun): ghc-compiler = %{ghc_version} + +%description devel +This package provides the Haskell %{pkg_name} library development files. + +%package -n ghc-%{pkg_name}-help +Summary: Haskell %{pkg_name} library documentation +BuildArch: noarch + +%description -n ghc-%{pkg_name}-help +This package provides the Haskell %{pkg_name} library documentation. + +%package -n ghc-%{pkg_name}-prof +Summary: Haskell %{pkg_name} profiling library +Requires: ghc-%{pkg_name}-devel = %{version}-%{release} +Supplements: (ghc-%{pkg_name}-devel and ghc-prof) + +%description -n ghc-%{pkg_name}-prof +This package provides the Haskell %{pkg_name} profiling library. + +%prep +%autosetup -n %{pkg_name}-%{version} + +%build +%ghc_lib_build + +%install +%ghc_lib_install + +%check +%cabal_test + +%post devel +%ghc_pkg_recache + +%postun devel +%ghc_pkg_recache + +%files -f %{name}.files +%license LICENSE + +%files devel -f %{name}-devel.files +%doc CHANGELOG.md README.md + +%files -n ghc-%{pkg_name}-help -f ghc-%{pkg_name}-help.files +%license LICENSE + +%files -n ghc-%{pkg_name}-prof -f ghc-%{pkg_name}-prof.files + +%changelog +* Tue Aug 22 2023 Lin Runze <lrzlin@163.com> 1.2.1.1-1 +- Initial packaging (Version 1.2.1.1) @@ -0,0 +1 @@ +c54b311b1dad1e5eccfda09d0b63abcd random-1.2.1.1.tar.gz |