extended-reals 0.2.4.0 → 0.2.5.0
raw patch · 4 files changed
+41/−109 lines, 4 filesdep ~QuickCheckdep ~basedep ~tasty-quickchecknew-uploaderPVP ok
version bump matches the API change (PVP)
Dependency ranges changed: QuickCheck, base, tasty-quickcheck
API changes (from Hackage documentation)
+ Data.ExtendedReal: fromRealFloat :: RealFloat r => r -> Extended r
Files
- .travis.yml +0/−97
- CHANGELOG.markdown +4/−0
- extended-reals.cabal +15/−9
- src/Data/ExtendedReal.hs +22/−3
− .travis.yml
@@ -1,97 +0,0 @@-language: c-sudo: false-dist: trusty--cache:- directories:- - $HOME/.cabsnap- - $HOME/.cabal/packages--before_cache:- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.tar--matrix:- include:- - env: CABALVER=1.18 GHCVER=7.8.4 COVERAGE=1- compiler: ": #GHC 7.8.4"- addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.4,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}- - env: CABALVER=1.22 GHCVER=7.10.3- compiler: ": #GHC 7.10.3"- addons: {apt: {packages: [cabal-install-1.22,ghc-7.10.3,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}- - env: CABALVER=1.24 GHCVER=8.0.2- compiler: ": #GHC 8.0.2"- addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.2,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}- - env: CABALVER=2.0 GHCVER=8.2.2- compiler: ": #GHC 8.2.2"- addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.2,alex-3.1.7,happy-1.19.5], sources: [hvr-ghc]}}- - env: CABALVER=2.0 GHCVER=8.4.4- compiler: ": #GHC 8.4.4"- addons: {apt: {packages: [cabal-install-2.0,ghc-8.4.4,alex-3.1.7,happy-1.19.5], sources: [hvr-ghc]}}- - env: CABALVER=2.4 GHCVER=8.6.5- compiler: ": #GHC 8.6.5"- addons: {apt: {packages: [cabal-install-2.4,ghc-8.6.5,alex-3.1.7,happy-1.19.5], sources: [hvr-ghc]}}- - env: CABALVER=2.4 GHCVER=8.8.3- compiler: ": #GHC 8.8.3"- addons: {apt: {packages: [cabal-install-2.4,ghc-8.8.3,alex-3.1.7,happy-1.19.5], sources: [hvr-ghc]}}--before_install:- - unset CC- - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:/opt/alex/3.1.4/bin:/opt/happy/1.19.5/bin:~/.cabal/bin:$PATH--install:- - cabal --version- - echo "$(ghc --version) [$(ghc --print-project-git-commit-id 2> /dev/null || echo '?')]"- - if [ -f $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz ];- then- zcat $HOME/.cabal/packages/hackage.haskell.org/00-index.tar.gz >- $HOME/.cabal/packages/hackage.haskell.org/00-index.tar;- fi- - travis_retry cabal update -v- - sed -i 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config- - cabal install --only-dependencies --enable-tests --enable-benchmarks --dry -v > installplan.txt- - sed -i -e '1,/^Resolving /d' installplan.txt; cat installplan.txt--# check whether current requested install-plan matches cached package-db snapshot- - if diff -u installplan.txt $HOME/.cabsnap/installplan.txt;- then- echo "cabal build-cache HIT";- rm -rfv .ghc;- cp -a $HOME/.cabsnap/ghc $HOME/.ghc;- cp -a $HOME/.cabsnap/lib $HOME/.cabsnap/share $HOME/.cabsnap/bin $HOME/.cabal/;- else- echo "cabal build-cache MISS";- rm -rf $HOME/.cabsnap;- mkdir -p $HOME/.ghc $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin;- cabal install --only-dependencies --enable-tests --enable-benchmarks;- fi--# snapshot package-db on cache miss- - if [ ! -d $HOME/.cabsnap ];- then- echo "snapshotting package-db to build-cache";- mkdir $HOME/.cabsnap;- cp -a $HOME/.ghc $HOME/.cabsnap/ghc;- cp -a $HOME/.cabal/lib $HOME/.cabal/share $HOME/.cabal/bin installplan.txt $HOME/.cabsnap/;- fi--# Here starts the actual work to be performed for the package under test;-# any command which exits with a non-zero exit code causes the build to fail.-script:- - if [ -f configure.ac ]; then autoreconf -i; fi- - cabal configure --enable-tests --enable-benchmarks -v2 $([ "$COVERAGE" = "1" ] && echo "--enable-library-coverage") # -v2 provides useful information for debugging- - cabal build # this builds all libraries and executables (including tests/benchmarks)- - cabal test- - cabal check- - cabal sdist # tests that a source-distribution can be generated--# Check that the resulting source distribution can be built & installed.-# If there are no other `.tar.gz` files in `dist`, this can be even simpler:-# `cabal install --force-reinstalls dist/*-*.tar.gz`- - SRC_TGZ=$(cabal info . | awk '{print $2;exit}').tar.gz &&- (cd dist && cabal install --force-reinstalls "$SRC_TGZ")--# This block must be executed before before_cache-#after_script:- - "[ -n \"$COVERAGE\" ] && cabal install hpc-coveralls --avoid-reinstalls --constraint=\"regex-posix >=0.95.2\" || true" # regex-posix-0.95.1 has compilation problem- - "[ -n \"$COVERAGE\" ] && hpc-coveralls TestExtendedReal --exclude-dir=test || true"
CHANGELOG.markdown view
@@ -1,3 +1,7 @@+# 0.2.5.0++* add `fromRealFloat` helper+ # 0.2.4.0 (2020-03-28) * support GHC 8.4, 8.6, 8.8
extended-reals.cabal view
@@ -1,5 +1,5 @@ name: extended-reals-version: 0.2.4.0+version: 0.2.5.0 synopsis: Extension of real numbers with positive/negative infinities description: Extension of real numbers with positive/negative infinities (±∞).@@ -11,26 +11,32 @@ maintainer: masahiro.sakai@gmail.com category: Math build-type: Simple-extra-source-files: .travis.yml, CHANGELOG.markdown+extra-source-files: CHANGELOG.markdown cabal-version: >=1.10 bug-reports: https://github.com/msakai/extended-reals/issues tested-with:- GHC ==7.8.4- GHC ==7.10.3 GHC ==8.0.2 GHC ==8.2.2 GHC ==8.4.4 GHC ==8.6.5- GHC ==8.8.3+ GHC ==8.8.4+ GHC ==8.10.7+ GHC ==9.0.2+ GHC ==9.2.8+ GHC ==9.4.8+ GHC ==9.6.6+ GHC ==9.8.4+ GHC ==9.10.1+ GHC ==9.12.1 source-repository head type: git- location: git://github.com/msakai/extended-reals.git+ location: https://github.com/msakai/extended-reals.git library exposed-modules: Data.ExtendedReal other-extensions: DeriveDataTypeable- build-depends: base >=4 && <5, deepseq >=1.3 && <1.5, hashable >=1.2 && <1.4+ build-depends: base >=4.9 && <5, deepseq >=1.3 && <1.6, hashable >=1.2 && <1.6 hs-source-dirs: src default-language: Haskell2010 @@ -42,10 +48,10 @@ base, deepseq, HUnit >=1.2 && <1.7,- QuickCheck >=2.6 && <2.15,+ QuickCheck >=2.6 && <2.16, tasty >=0.10.1, tasty-hunit >=0.9 && <0.11,- tasty-quickcheck >=0.8 && <0.11,+ tasty-quickcheck >=0.8 && <0.12, tasty-th, extended-reals Default-Language: Haskell2010
src/Data/ExtendedReal.hs view
@@ -31,20 +31,22 @@ , inf , isFinite , isInfinite+ , fromRealFloat ) where import Prelude hiding (isInfinite)+import qualified Prelude as P import Control.DeepSeq-import Data.Data+import Data.Data (Data) import Data.Hashable-import Data.Typeable+import Data.Typeable (Typeable) -- | @Extended r@ is an extension of /r/ with positive/negative infinity (±∞). data Extended r = NegInf -- ^ negative infinity (-∞) | Finite !r -- ^ finite value | PosInf -- ^ positive infinity (+∞)- deriving (Ord, Eq, Show, Read, Typeable, Data)+ deriving (Ord, Eq, Show, Read, Data) instance Bounded (Extended r) where minBound = NegInf@@ -133,3 +135,20 @@ NegInf -> PosInf Finite b -> Finite (a*b) PosInf -> NegInf++-- | Helper to convert 'Double' and 'Float' to 'Extended',+-- taking care of infinite values automatically.+--+-- >>> fromRealFloat (1 / 0)+-- PosInf+-- >>> fromRealFloat (-1 / 0)+-- NegInf+-- >>> fromRealFloat (0 / 0)+-- *** Exception: fromRealFloat: argument should not be NaN+--+-- @since 0.2.5.0+fromRealFloat :: RealFloat r => r -> Extended r+fromRealFloat x+ | isNaN x = error "fromRealFloat: argument should not be NaN"+ | P.isInfinite x = if x > 0 then PosInf else NegInf+ | otherwise = Finite x