packages feed

extended-reals 0.2.1.0 → 0.2.2.0

raw patch · 3 files changed

+121/−55 lines, 3 filesdep ~HUnitdep ~QuickCheckdep ~deepseqPVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: HUnit, QuickCheck, deepseq

API changes (from Hackage documentation)

- Data.ExtendedReal: instance (Fractional r, Ord r) => Fractional (Extended r)
- Data.ExtendedReal: instance (Num r, Ord r) => Num (Extended r)
- Data.ExtendedReal: instance Bounded (Extended r)
- Data.ExtendedReal: instance Data r => Data (Extended r)
- Data.ExtendedReal: instance Eq r => Eq (Extended r)
- Data.ExtendedReal: instance Functor Extended
- Data.ExtendedReal: instance Hashable r => Hashable (Extended r)
- Data.ExtendedReal: instance NFData r => NFData (Extended r)
- Data.ExtendedReal: instance Ord r => Ord (Extended r)
- Data.ExtendedReal: instance Read r => Read (Extended r)
- Data.ExtendedReal: instance Show r => Show (Extended r)
- Data.ExtendedReal: instance Typeable Extended
+ Data.ExtendedReal: instance (GHC.Num.Num r, GHC.Classes.Ord r) => GHC.Num.Num (Data.ExtendedReal.Extended r)
+ Data.ExtendedReal: instance (GHC.Real.Fractional r, GHC.Classes.Ord r) => GHC.Real.Fractional (Data.ExtendedReal.Extended r)
+ Data.ExtendedReal: instance Control.DeepSeq.NFData r => Control.DeepSeq.NFData (Data.ExtendedReal.Extended r)
+ Data.ExtendedReal: instance Data.Data.Data r => Data.Data.Data (Data.ExtendedReal.Extended r)
+ Data.ExtendedReal: instance Data.Hashable.Class.Hashable r => Data.Hashable.Class.Hashable (Data.ExtendedReal.Extended r)
+ Data.ExtendedReal: instance GHC.Base.Functor Data.ExtendedReal.Extended
+ Data.ExtendedReal: instance GHC.Classes.Eq r => GHC.Classes.Eq (Data.ExtendedReal.Extended r)
+ Data.ExtendedReal: instance GHC.Classes.Ord r => GHC.Classes.Ord (Data.ExtendedReal.Extended r)
+ Data.ExtendedReal: instance GHC.Enum.Bounded (Data.ExtendedReal.Extended r)
+ Data.ExtendedReal: instance GHC.Read.Read r => GHC.Read.Read (Data.ExtendedReal.Extended r)
+ Data.ExtendedReal: instance GHC.Show.Show r => GHC.Show.Show (Data.ExtendedReal.Extended r)

Files

.travis.yml view
@@ -1,64 +1,87 @@-# NB: don't set `language: haskell` here+language: c+sudo: false -# The following enables several GHC versions to be tested; often it's enough to test only against the last release in a major GHC version. Feel free to omit lines listings versions you don't need/want testing for.-env:-# - CABALVER=1.16 GHCVER=6.12.3-# - CABALVER=1.16 GHCVER=7.0.1-# - CABALVER=1.16 GHCVER=7.0.2-# - CABALVER=1.16 GHCVER=7.0.3-# - CABALVER=1.16 GHCVER=7.0.4-# - CABALVER=1.16 GHCVER=7.2.1-# - CABALVER=1.16 GHCVER=7.2.2-# - CABALVER=1.16 GHCVER=7.4.1- - CABALVER=1.16 GHCVER=7.4.2-# - CABALVER=1.16 GHCVER=7.6.1-# - CABALVER=1.16 GHCVER=7.6.2- - CABALVER=1.18 GHCVER=7.6.3-# - CABALVER=1.18 GHCVER=7.8.1  # see note about Alex/Happy for GHC >= 7.8-# - CABALVER=1.18 GHCVER=7.8.2- - CABALVER=1.18 GHCVER=7.8.3- - CABALVER=1.22 GHCVER=7.10.1-# - CABALVER=head GHCVER=head   # see section about GHC HEAD snapshots+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:-  allow_failures:-   - env: CABALVER=1.22 GHCVER=7.10.1+  include:+    - env: CABALVER=1.18 GHCVER=7.6.3+      compiler: ": #GHC 7.6.3"+      addons: {apt: {packages: [cabal-install-1.18,ghc-7.6.3,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}}+    - env: CABALVER=1.18 GHCVER=7.8.3 COVERAGE=1+      compiler: ": #GHC 7.8.3"+      addons: {apt: {packages: [cabal-install-1.18,ghc-7.8.3,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.1+      compiler: ": #GHC 8.0.1"+      addons: {apt: {packages: [cabal-install-1.24,ghc-8.0.1,alex-3.1.4,happy-1.19.5], sources: [hvr-ghc]}} -# Note: the distinction between `before_install` and `install` is not important. before_install:- - travis_retry sudo add-apt-repository -y ppa:hvr/ghc- - travis_retry sudo apt-get update- - travis_retry sudo apt-get install cabal-install-$CABALVER ghc-$GHCVER # see note about happy/alex- - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH- - |-   if [ $GHCVER = "head" ] || [ ${GHCVER%.*} = "7.8" ] || [ ${GHCVER%.*} = "7.10" ]; then-     travis_retry sudo apt-get install happy-1.19.4 alex-3.1.3-     export PATH=/opt/alex/3.1.3/bin:/opt/happy/1.19.4/bin:$PATH-   else-     travis_retry sudo apt-get install happy alex-   fi+ - 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 '?')]"- - travis_retry cabal update- - cabal install --only-dependencies --enable-tests --enable-benchmarks+ - 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 -# 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.+# 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  # -v2 provides useful information for debugging+ - 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 -# The following scriptlet checks that the resulting source distribution can be built & installed- - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ;-   cd dist/;-   if [ -f "$SRC_TGZ" ]; then-      cabal install --force-reinstalls "$SRC_TGZ";-   else-      echo "expected '$SRC_TGZ' not found";-      exit 1;-   fi+# 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"
extended-reals.cabal view
@@ -1,5 +1,5 @@ name:                extended-reals-version:             0.2.1.0+version:             0.2.2.0 synopsis:            Extension of real numbers with positive/negative infinities description:   Extension of real numbers with positive/negative infinities (±∞).@@ -30,7 +30,7 @@   Type:              exitcode-stdio-1.0   HS-Source-Dirs:    test   Main-is:           TestExtendedReal.hs-  Build-depends:     base, HUnit >=1.2 && <1.3, QuickCheck >=2.6 && <2.8, test-framework >=0.8 && <0.9, test-framework-th >=0.2 && <0.3, test-framework-hunit >=0.3 && <0.4, test-framework-quickcheck2 >=0.3 && <0.4, extended-reals+  Build-depends:     base, deepseq, HUnit >=1.2 && <1.4, QuickCheck >=2.6 && <2.9, test-framework >=0.8 && <0.9, test-framework-th >=0.2 && <0.3, test-framework-hunit >=0.3 && <0.4, test-framework-quickcheck2 >=0.3 && <0.4, extended-reals   Default-Language: Haskell2010   Other-Extensions:      TemplateHaskell
test/TestExtendedReal.hs view
@@ -2,12 +2,14 @@ {-# LANGUAGE TemplateHaskell, ScopedTypeVariables #-}  import Prelude hiding (isInfinite)+import Control.DeepSeq import Control.Exception (SomeException, evaluate, try) import Control.Monad import Data.Maybe import System.IO.Unsafe (unsafePerformIO) import Test.HUnit hiding (Test) import Test.QuickCheck+import Test.QuickCheck.Function import Test.Framework.TH import Test.Framework.Providers.HUnit import Test.Framework.Providers.QuickCheck2@@ -137,15 +139,56 @@ case_recip_NegInf :: IO () case_recip_NegInf = recip (- inf) @?= (0 :: Extended Rational) -prop_NegInf_smallest :: Property-prop_NegInf_smallest =+prop_minBound_smallest :: Property+prop_minBound_smallest =   forAll arbitrary $ \(a :: Extended Rational) ->-    -inf <= a+    minBound <= a -prop_PosInf_largest :: Property-prop_PosInf_largest =+prop_maxBound_largest :: Property+prop_maxBound_largest =   forAll arbitrary $ \(a :: Extended Rational) ->-    a <= inf+    a <= maxBound++prop_isFinite_fromRational :: Property+prop_isFinite_fromRational =+  forAll arbitrary $ \a -> isFinite (fromRational a :: Extended Rational)++prop_isInfinite_PosInf :: Property+prop_isInfinite_PosInf = property $ isInfinite PosInf++prop_isInfinite_NegInf :: Property+prop_isInfinite_NegInf = property $ isInfinite NegInf++-- ----------------------------------------------------------------------+-- Functor++prop_Functor_id :: Property+prop_Functor_id =+  forAll arbitrary $ \(a :: Extended Integer) ->+    fmap id a == a++prop_Functor_comp :: Property+prop_Functor_comp =+  forAll arbitrary $ \(f :: Fun Integer Integer) ->+  forAll arbitrary $ \(g :: Fun Integer Integer) ->+  forAll arbitrary $ \(a :: Extended Integer) ->+    fmap (apply f . apply g) a == fmap (apply f) (fmap (apply g) a)++-- ----------------------------------------------------------------------+-- Show / Read++prop_read_show :: Property+prop_read_show =+  forAll arbitrary $ \(a :: Extended Rational) ->+    read (show a) == a++-- ----------------------------------------------------------------------+-- deepseq++prop_deepseq :: Property+prop_deepseq =+  forAll arbitrary $ \(a :: Extended Rational) ->+    a `deepseq` () == ()  -- ---------------------------------------------------------------------- -- Test harness