primecount 0.1.0.1 → 0.1.0.2
raw patch · 12 files changed
+118/−84 lines, 12 filesdep ~basedep ~tastydep ~tasty-benchsetup-changed
Dependency ranges changed: base, tasty, tasty-bench
Files
- CHANGELOG.md +56/−0
- ChangeLog.md +0/−20
- LICENSE +0/−26
- LICENSES/BSD-3-Clause.txt +11/−0
- README.md +20/−15
- Setup.hs +0/−3
- bench/Main.hs +3/−1
- primecount.cabal +12/−12
- src/Math/NumberTheory/Prime/Count.hs +7/−5
- src/Math/NumberTheory/Prime/Count/FFI.hs +3/−1
- test/Main.hs +3/−0
- test/Test/Math/NumberTheory/Prime/Count.hs +3/−1
+ CHANGELOG.md view
@@ -0,0 +1,56 @@+<!--+SPDX-FileCopyrightText: Copyright Preetham Gujjula+SPDX-License-Identifier: BSD-3-Clause+-->++# Changelog for primecount++## 0.1.0.2++### Release History++| Release | Date | Tag |+| --------------- | ---------- | ---------------- |+| Initial Release | 2024-12-23 | [`0.1.0.2`] |++### Added+* Made project REUSE compliant (https://reuse.software) with respect to+ copyright and licensing.++### Updated+* Supported GHC versions are now: 8.10, 9.0, 9.2, 9.4, 9.6, 9.8, 9.10, and 9.12.++## 0.1.0.1++### Release History++| Release | Date | Tag |+| --------------- | ---------- | ---------------- |+| Initial Release | 2023-08-24 | [`0.1.0.1`] |+| Revision 1 | 2023-09-11 | [`0.1.0.1-rev1`] |++### Updated+* Supported GHC versions are now: 8.10, 9.0, 9.2, 9.4, and 9.6.+ * Support for GHC 8.4, 8.6 and 8.8 is dropped.++## 0.1.0.0++| Release | Date | Tag |+| --------------- | ---------- | ---------------- |+| Initial Release | 2022-01-07 | [`0.1.0.0`] |++### Added+* `Math.NumberTheory.Prime.Count.FFI`, with FFI bindings to all functions from the+ `primecount` library.+* `Math.NumberTheory.Prime.Count`, with high-level wrappers (`primePi`,+ `nthPrime`, and `primePhi`) around the functions in+ `Math.NumberTheory.Prime.Count.FFI`.+* Test coverage of `primePi`, `nthPrime`, and `primePhi` with `tasty-hunit`.+* Benchmarks of `primePi`, `nthPrime`, and `primePhi` with `tasty-bench`.+* Full Haddock documentation coverage.+* Support for GHC 8.4, 8.6, 8.8, 8.10, 9.0, and 9.2.++[`0.1.0.2`]: https://github.com/pgujjula/primecount-haskell/releases/tag/0.1.0.2+[`0.1.0.1-rev1`]: https://github.com/pgujjula/primecount-haskell/releases/tag/0.1.0.1-rev1+[`0.1.0.1`]: https://github.com/pgujjula/primecount-haskell/releases/tag/0.1.0.1+[`0.1.0.0`]: https://github.com/pgujjula/primecount-haskell/releases/tag/0.1.0.0
− ChangeLog.md
@@ -1,20 +0,0 @@-# Changelog--## 0.1.0.1--### Updated-* CI now supports GHC versions 9.6.2, 9.4.5, 9.2.8, 9.0.2, and 8.10.7.--## 0.1.0.0--### Added-* `Math.NumberTheory.Prime.Count.FFI`, with FFI bindings to all functions from the- `primecount` library.-* `Math.NumberTheory.Prime.Count`, with high-level wrappers (`primePi`,- `nthPrime`, and `primePhi`) around the functions in- `Math.NumberTheory.Prime.Count.FFI`.-* Test coverage of `primePi`, `nthPrime`, and `primePhi` with `tasty-hunit`.-* Benchmarks of `primePi`, `nthPrime`, and `primePhi` with `tasty-bench`.-* Full Haddock documentation coverage.-* Support for GHC 9.2.1, 9.0.1, 8.10.7, 8.8.4, 8.6.5, and 8.4.4, and- libprimecount v7.x, verified by GitHub Actions.
− LICENSE
@@ -1,26 +0,0 @@-Copyright 2021 Preetham Gujjula--Redistribution and use in source and binary forms, with or without modification,-are permitted provided that the following conditions are met:--1. Redistributions of source code must retain the above copyright notice, this- list of conditions and the following disclaimer.--2. Redistributions in binary form must reproduce the above copyright notice,- this list of conditions and the following disclaimer in the documentation- and/or other materials provided with the distribution.--3. Neither the name of the copyright holder nor the names of its contributors- may be used to endorse or promote products derived from this software without- specific prior written permission.--THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND-ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED-WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE-DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR-ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES-(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;-LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON-ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT-(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS-SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+ LICENSES/BSD-3-Clause.txt view
@@ -0,0 +1,11 @@+Copyright (c) <year> <owner>.++Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:++1. Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.++2. Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.++3. Neither the name of the copyright holder nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.++THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
README.md view
@@ -1,6 +1,16 @@+<!--+SPDX-FileCopyrightText: Copyright Preetham Gujjula+SPDX-License-Identifier: BSD-3-Clause+-->+ # `primecount` for Haskell-[](https://github.com/pgujjula/primecount-haskell/actions/workflows/haskell-ci.yml) +[](https://haskell.org)+[](https://github.com/pgujjula/primecount-haskell/actions/workflows/ci.yml)+[](https://hackage.haskell.org/package/primecount)+[](https://www.stackage.org/nightly/package/primecount)+[](https://www.stackage.org/lts/package/primecount)+ This library provides Haskell bindings to Kim Walisch's [primecount](https://github.com/kimwalisch/primecount) library. @@ -13,20 +23,7 @@ `primecount-devel`. The current version of the Haskell bindings supports any version of `libprimecount >= 7.0`. -Then you can build the Haskell bindings with Stack or Cabal, and read the-documentation.-```-# Stack-stack build-stack test-stack haddock primecount --open--# Cabal-cabal update-cabal build-cabal test-cabal haddock # and then open the documentation manually-```+Then you can build the Haskell bindings with Stack or Cabal as usual. ### Building `libprimecount` from source If you build and install the original `primecount` library from source, instead@@ -52,6 +49,14 @@ or pass `--extra-lib-dirs=/usr/local/lib64 --extra-include-dirs=/usr/local/include` as an argument to Cabal.++## Licensing++[](https://api.reuse.software/info/github.com/pgujjula/primecount-haskell)++This project licensed under BSD-3-Clause (except for `.gitignore`, which is+under CC0-1.0), and follows [REUSE](https://reuse.software) licensing+principles. ## Bugs Report any bugs on the Github issue tracker, or by emailing
− Setup.hs
@@ -1,3 +0,0 @@-import Distribution.Simple--main = defaultMain
bench/Main.hs view
@@ -1,5 +1,7 @@+-- SPDX-FileCopyrightText: Copyright Preetham Gujjula+-- SPDX-License-Identifier: BSD-3-Clause+ -- |--- Copyright : 2022 Preetham Gujjula -- License : BSD-3-Clause -- Maintainer : libraries@mail.preetham.io -- Stability : experimental
primecount.cabal view
@@ -1,11 +1,11 @@-cabal-version: 2.2+cabal-version: 3.6 -- This file has been generated from package.yaml by hpack version 0.35.1. -- -- see: https://github.com/sol/hpack name: primecount-version: 0.1.0.1+version: 0.1.0.2 synopsis: Bindings to the primecount library description: Please see the README on Github at <https://github.com/pgujjula/primecount-haskell#readme> category: Math, Number Theory@@ -13,15 +13,15 @@ bug-reports: https://github.com/pgujjula/primecount-haskell/issues author: Preetham Gujjula maintainer: libraries@mail.preetham.io-copyright: 2021 Preetham Gujjula+copyright: Preetham Gujjula license: BSD-3-Clause-license-file: LICENSE+license-file: LICENSES/BSD-3-Clause.txt build-type: Simple tested-with:- GHC ==8.10.7 || ==9.0.2 || ==9.2.8 || ==9.4.5 || ==9.6.2-extra-source-files:+ GHC == {8.10.7, 9.0.2, 9.2.8, 9.4.8, 9.6.6, 9.8.2, 9.10.1, 9.12.1}+extra-doc-files: README.md- ChangeLog.md+ CHANGELOG.md source-repository head type: git@@ -39,7 +39,7 @@ extra-libraries: primecount build-depends:- base >=4.7 && <5.0+ base >=4.14 && <4.15 || >=4.15 && <4.16 || >=4.16 && <4.17 || >=4.17 && <4.18 || >=4.18 && <4.19 || >=4.19 && <4.20 || >=4.20 && <4.21 || >=4.21 && <4.22 default-language: Haskell2010 test-suite primecount-tests@@ -53,10 +53,10 @@ ScopedTypeVariables ghc-options: -Wall -Wcompat -Wmissing-export-lists -Wincomplete-record-updates -Wpartial-fields -Wmissing-home-modules -Werror=missing-home-modules -Widentities -Wredundant-constraints -Wmissing-export-lists build-depends:- base >=4.7 && <5.0+ base >=4.14 && <4.15 || >=4.15 && <4.16 || >=4.16 && <4.17 || >=4.17 && <4.18 || >=4.18 && <4.19 || >=4.19 && <4.20 || >=4.20 && <4.21 || >=4.21 && <4.22 , primecount , silently ==1.2.*- , tasty ==1.4.*+ , tasty >=1.4 && <1.5 || >=1.5 && <1.6 , tasty-hunit ==0.10.* default-language: Haskell2010 @@ -69,7 +69,7 @@ ScopedTypeVariables ghc-options: -Wall -Wcompat -Wmissing-export-lists -Wincomplete-record-updates -Wpartial-fields -Wmissing-home-modules -Werror=missing-home-modules -Widentities -Wredundant-constraints -Wmissing-export-lists build-depends:- base >=4.7 && <5.0+ base >=4.14 && <4.15 || >=4.15 && <4.16 || >=4.16 && <4.17 || >=4.17 && <4.18 || >=4.18 && <4.19 || >=4.19 && <4.20 || >=4.20 && <4.21 || >=4.21 && <4.22 , primecount- , tasty-bench ==0.3.*+ , tasty-bench >=0.3 && <0.4 || >=0.4 && <0.5 default-language: Haskell2010
src/Math/NumberTheory/Prime/Count.hs view
@@ -1,6 +1,8 @@+-- SPDX-FileCopyrightText: Copyright Preetham Gujjula+-- SPDX-License-Identifier: BSD-3-Clause+ -- | -- Module : Math.NumberTheory.Prime.Count--- Copyright : 2021 Preetham Gujjula -- License : BSD-3-Clause -- Maintainer : libraries@mail.preetham.io -- Stability : experimental@@ -32,7 +34,7 @@ -- is larger than 'primePiMaxBound'. Also might throw an error if there's not -- enough memory available to compute the result, which can happen even if @n@ -- is smaller than @primePiMaxBound@.-primePi :: Integral a => a -> a+primePi :: (Integral a) => a -> a primePi n | n < 0 = 0 | n' <= bound = fromIntegral (primecount_pi (fromInteger n'))@@ -72,8 +74,8 @@ -- | The nth prime, starting at @nthPrime 1 == 2@. -- -- * Throws an error if the input is less than 1.--- * Throws an error if the input is larger than 'nthPrimeMaxBound`.-nthPrime :: Integral a => a -> a+-- * Throws an error if the input is larger than 'nthPrimeMaxBound'.+nthPrime :: (Integral a) => a -> a nthPrime n | n < 1 = error "nthPrime: n must be >= 1" | n' > bound = error "nthPrime: answer cannot be packed into a 64-bit int"@@ -93,7 +95,7 @@ -- | @primePhi n a@ counts the number of positive integers @<= n@ that are not -- divisible by any of the first @a@ primes. Throws an error if @n@ is larger -- than @'maxBound' :: 'Int64'@.-primePhi :: Integral a => a -> a -> a+primePhi :: (Integral a) => a -> a -> a primePhi n a | n <= 0 = 0 | a <= 0 = n
src/Math/NumberTheory/Prime/Count/FFI.hs view
@@ -1,6 +1,8 @@+-- SPDX-FileCopyrightText: Copyright Preetham Gujjula+-- SPDX-License-Identifier: BSD-3-Clause+ -- | -- Module : Math.NumberTheory.Prime.Count.FFI--- Copyright : 2021 Preetham Gujjula -- License : BSD-3-Clause -- Maintainer : libraries@mail.preetham.io -- Stability : experimental
test/Main.hs view
@@ -1,3 +1,6 @@+-- SPDX-FileCopyrightText: Copyright Preetham Gujjula+-- SPDX-License-Identifier: BSD-3-Clause+ -- | -- Copyright : 2021 Preetham Gujjula -- License : BSD-3-Clause
test/Test/Math/NumberTheory/Prime/Count.hs view
@@ -1,5 +1,7 @@+-- SPDX-FileCopyrightText: Copyright Preetham Gujjula+-- SPDX-License-Identifier: BSD-3-Clause+ -- |--- Copyright : 2021 Preetham Gujjula -- License : BSD-3-Clause -- Maintainer : libraries@mail.preetham.io -- Stability : experimental