packages feed

intervals 0.8.1 → 0.9.3

raw patch · 15 files changed

Files

+ .hlint.yaml view
@@ -0,0 +1,12 @@+- arguments: [--cpp-define=HLINT, --cpp-ansi]++# not viable+- ignore: {name: Reduce duplication}++# don't want to!+- ignore: {name: Use infix}++# these don't consider the corner cases when using doubles+- ignore: {name: "Use >"}+- ignore: {name: "Use <="}+- ignore: {name: "Use >="}
− .travis.yml
@@ -1,121 +0,0 @@-# This file has been generated -- see https://github.com/hvr/multi-ghc-travis-language: c-sudo: false--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.24 GHCVER=7.0.4-      compiler: ": #GHC 7.0.4"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.0.4], sources: [hvr-ghc]}}-    - env: CABALVER=1.24 GHCVER=7.2.2-      compiler: ": #GHC 7.2.2"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.2.2], sources: [hvr-ghc]}}-    - env: CABALVER=1.24 GHCVER=7.4.2-      compiler: ": #GHC 7.4.2"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.4.2], sources: [hvr-ghc]}}-    - env: CABALVER=1.24 GHCVER=7.6.3-      compiler: ": #GHC 7.6.3"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.6.3], sources: [hvr-ghc]}}-    - env: CABALVER=1.24 GHCVER=7.8.4-      compiler: ": #GHC 7.8.4"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.8.4], sources: [hvr-ghc]}}-    - env: CABALVER=1.24 GHCVER=7.10.3-      compiler: ": #GHC 7.10.3"-      addons: {apt: {packages: [cabal-install-1.24,ghc-7.10.3], 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], sources: [hvr-ghc]}}-    - env: CABALVER=2.0 GHCVER=8.2.1-      compiler: ": #GHC 8.2.1"-      addons: {apt: {packages: [cabal-install-2.0,ghc-8.2.1], sources: [hvr-ghc]}}-    - env: CABALVER=head GHCVER=head-      compiler: ": #GHC head"-      addons: {apt: {packages: [cabal-install-head,ghc-head], sources: [hvr-ghc]}}--  allow_failures:-    - env: CABALVER=1.24 GHCVER=7.0.4-    - env: CABALVER=1.24 GHCVER=7.2.2-    - env: CABALVER=head GHCVER=head--before_install:- - unset CC- - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/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 --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 -j --only-dependencies --enable-tests;-   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:- # -v2 provides useful information for debugging- - cabal configure --enable-tests -v2-- # this builds all libraries and executables- # (including tests/benchmarks)- - cabal build-- # tests that a source-distribution can be generated- - cabal sdist-- # check that the generated 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--notifications:-  irc:-    channels:-      - "irc.freenode.org#haskell-lens"-    skip_join: true-    template:-      - "\x0313intervals\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"--# EOF
CHANGELOG.markdown view
@@ -1,3 +1,26 @@+0.9.3 [2024.12.04]+------------------+* Drop support for pre-8.0 versions of GHC.++0.9.2 [2021.02.17]+------------------+* Export `(/=!)` and `(/=?)` operators.+* The build-type has been changed from `Custom` to `Simple`.+  To achieve this, the `doctests` test suite has been removed in favor of using+  [`cabal-docspec`](https://github.com/phadej/cabal-extras/tree/master/cabal-docspec)+  to run the doctests.++0.9.1 [2020.01.29]+------------------+* Add `Semigroup` instances for the `Interval` types in `Numeric.Interval`,+  `Numeric.Interval.Kaucher`, and `Numeric.Interval.NonEmpty`.+  Add a `Monoid` instance for the `Interval` type in `Numeric.Interval`.++0.9 [2019.05.10]+----------------+* Remove the `Foldable` instances for the `Interval` types from+  `Numeric.Interval` and `Numeric.Interval.NonEmpty`.+ 0.8.1 ----- * Support `doctest-0.12`
− HLint.hs
@@ -1,12 +0,0 @@-import "hint" HLint.HLint---- not viable-ignore "Reduce duplication"---- don't want to!-ignore "Use infix"---- these don't consider the corner cases when using doubles-ignore "Use >"-ignore "Use <="-ignore "Use >="
README.markdown view
@@ -1,7 +1,7 @@ intervals ========== -[![Hackage](https://img.shields.io/hackage/v/intervals.svg)](https://hackage.haskell.org/package/intervals) [![Build Status](https://secure.travis-ci.org/ekmett/intervals.svg?branch=master)](http://travis-ci.org/ekmett/intervals)+[![Hackage](https://img.shields.io/hackage/v/intervals.svg)](https://hackage.haskell.org/package/intervals) [![Build Status](https://github.com/ekmett/intervals/workflows/Haskell-CI/badge.svg)](https://github.com/ekmett/intervals/actions?query=workflow%3AHaskell-CI)  Basic interval arithmetic 
Setup.lhs view
@@ -1,34 +1,7 @@-\begin{code}-{-# LANGUAGE CPP #-}-{-# OPTIONS_GHC -Wall #-}-module Main (main) where--#ifndef MIN_VERSION_cabal_doctest-#define MIN_VERSION_cabal_doctest(x,y,z) 0-#endif--#if MIN_VERSION_cabal_doctest(1,0,0)--import Distribution.Extra.Doctest ( defaultMainWithDoctests )-main :: IO ()-main = defaultMainWithDoctests "doctests"--#else--#ifdef MIN_VERSION_Cabal--- If the macro is defined, we have new cabal-install,--- but for some reason we don't have cabal-doctest in package-db------ Probably we are running cabal sdist, when otherwise using new-build--- workflow-import Warning ()-#endif--import Distribution.Simple--main :: IO ()-main = defaultMain+#!/usr/bin/runhaskell+> module Main (main) where -#endif+> import Distribution.Simple -\end{code}+> main :: IO ()+> main = defaultMain
− Warning.hs
@@ -1,5 +0,0 @@-module Warning-  {-# WARNING ["You are configuring this package without cabal-doctest installed.",-               "The doctests test-suite will not work as a result.",-               "To fix this, install cabal-doctest before configuring."] #-}-  () where
intervals.cabal view
@@ -1,5 +1,5 @@ name:              intervals-version:           0.8.1+version:           0.9.3 synopsis:          Interval Arithmetic description:   A 'Numeric.Interval.Interval' is a closed, convex set of floating point values.@@ -15,33 +15,29 @@ author:             Edward Kmett maintainer:         ekmett@gmail.com category:           Math-build-type:         Custom-cabal-version:      >=1.8-tested-with:        GHC == 7.4.2, GHC == 7.6.1, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.3, GHC == 8.0.2, GHC == 8.2.1+build-type:         Simple+cabal-version:      >=1.10+tested-with:        GHC == 8.0.2+                  , GHC == 8.2.2+                  , GHC == 8.4.4+                  , GHC == 8.6.5+                  , 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 extra-source-files:-  .travis.yml+  .hlint.yaml   CHANGELOG.markdown   README.markdown-  HLint.hs-  Warning.hs  source-repository head   type: git   location: git://github.com/ekmett/intervals.git -custom-setup-  setup-depends:-    base >= 4 && <5,-    Cabal,-    cabal-doctest >= 1 && <1.1---- You can disable the doctests test suite with -f-test-doctests-flag test-doctests-  description: Enable (or disable via f-test-doctests) the doctest suite when-               using the enable-tests option for cabal.-  default: True-  manual: True- flag herbie   default: False   manual: True@@ -59,11 +55,9 @@    build-depends:     array          >= 0.3   && < 0.6,-    base           >= 4     && < 5,-    distributive   >= 0.2   && < 1--  if impl(ghc >=7.4)-    build-depends: ghc-prim+    base           >= 4.9   && < 5,+    distributive   >= 0.2   && < 1,+    ghc-prim    ghc-options:     -Wall -O2 @@ -72,21 +66,15 @@     cpp-options: -DHERBIE     ghc-options: -fplugin=Herbie +  default-language: Haskell2010+  x-docspec-options: --check-properties+  x-docspec-property-variables: i x y xs ys  test-suite doctests   type:           exitcode-stdio-1.0   main-is:        doctests.hs   ghc-options:    -Wall -threaded   hs-source-dirs: tests--  if !flag(test-doctests)-    buildable: False-  else-    build-depends:-      base,-      directory      >= 1.0,-      doctest        >= 0.11.1 && <0.13,-      filepath,-      intervals,-      QuickCheck,-      template-haskell+  build-depends:  base >= 4.9 && < 5+                , QuickCheck >=2.14.2+  default-language: Haskell2010
src/Numeric/Interval.hs view
@@ -38,8 +38,8 @@   , scale, symmetric   , contains   , isSubsetOf-  , certainly, (<!), (<=!), (==!), (>=!), (>!)-  , possibly, (<?), (<=?), (==?), (>=?), (>?)+  , certainly, (<!), (<=!), (==!), (/=!), (>=!), (>!)+  , possibly, (<?), (<=?), (==?), (/=?), (>=?), (>?)   , idouble   , ifloat   , iquot
src/Numeric/Interval/Exception.hs view
@@ -8,7 +8,7 @@ import Data.Data  data EmptyInterval = EmptyInterval-  deriving (Eq,Ord,Typeable,Data)+  deriving (Eq,Ord,Data)  instance Show EmptyInterval where   show EmptyInterval = "empty interval"@@ -16,7 +16,7 @@ instance Exception EmptyInterval  data AmbiguousComparison = AmbiguousComparison-  deriving (Eq,Ord,Typeable,Data)+  deriving (Eq,Ord,Data)  instance Show AmbiguousComparison where   show AmbiguousComparison = "ambiguous comparison"
src/Numeric/Interval/Internal.hs view
@@ -1,9 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE DeriveDataTypeable #-}-#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE DeriveGeneric #-}-#endif {-# OPTIONS_HADDOCK not-home #-} ----------------------------------------------------------------------------- -- |@@ -46,8 +44,8 @@   , scale, symmetric   , contains   , isSubsetOf-  , certainly, (<!), (<=!), (==!), (>=!), (>!)-  , possibly, (<?), (<=?), (==?), (>=?), (>?)+  , certainly, (<!), (<=!), (==!), (/=!), (>=!), (>!)+  , possibly, (<?), (<=?), (==?), (/=?), (>=?), (>?)   , idouble   , ifloat   , iquot@@ -58,37 +56,30 @@  import Control.Exception as Exception import Data.Data-import Data.Foldable hiding (minimum, maximum, elem, notElem-#if __GLASGOW_HASKELL__ >= 710-  , null-#endif-  ) import Data.Function (on)-import Data.Monoid-#if __GLASGOW_HASKELL__ >= 704 import GHC.Generics-#endif import Numeric.Interval.Exception import Prelude hiding (null, elem, notElem) +import qualified Data.Semigroup+import qualified Data.Monoid+ -- $setup+-- >>> :set -Wno-deprecations+-- >>> let null = Numeric.Interval.Internal.null+-- >>> let elem = Numeric.Interval.Internal.elem+-- >>> let notElem = Numeric.Interval.Internal.notElem  data Interval a = I !a !a | Empty deriving-  ( Eq, Ord-  , Data-  , Typeable-#if __GLASGOW_HASKELL__ >= 704-  , Generic-#if __GLASGOW_HASKELL__ >= 706-  , Generic1-#endif-#endif-  )+  (Eq, Ord, Data, Generic, Generic1) -instance Foldable Interval where-  foldMap f (I a b) = f a `mappend` f b-  foldMap _ Empty = mempty-  {-# INLINE foldMap #-}+-- | 'Data.Semigroup.<>' is 'hull'+instance Ord a => Data.Semigroup.Semigroup (Interval a) where+  (<>) = hull++instance Ord a => Data.Monoid.Monoid (Interval a) where+  mempty = empty+  mappend = (Data.Semigroup.<>)  infix 3 ... infixl 6 +/-
src/Numeric/Interval/Kaucher.hs view
@@ -1,9 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE DeriveDataTypeable #-}-#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE DeriveGeneric #-}-#endif ----------------------------------------------------------------------------- -- | -- Module      :  Numeric.Interval@@ -44,8 +42,8 @@   , scale, symmetric   , contains   , isSubsetOf-  , certainly, (<!), (<=!), (==!), (>=!), (>!)-  , possibly, (<?), (<=?), (==?), (>=?), (>?)+  , certainly, (<!), (<=!), (==!), (/=!), (>=!), (>!)+  , possibly, (<?), (<=?), (==?), (/=?), (>=?), (>?)   , clamp   , idouble   , ifloat@@ -59,40 +57,35 @@ import Control.Exception as Exception import Data.Data import Data.Distributive-import Data.Foldable hiding (minimum, maximum, elem, notElem-#if __GLASGOW_HASKELL__ >= 710-  , null-#endif-  )+import Data.Foldable hiding (minimum, maximum, elem, notElem, null) import Data.Function (on)-import Data.Monoid import Data.Traversable-#if __GLASGOW_HASKELL__ >= 704 import GHC.Generics-#endif import Numeric.Interval.Exception import Prelude hiding (null, elem, notElem) +import qualified Data.Semigroup+import qualified Data.Monoid+ -- $setup+-- >>> :set -Wno-deprecations+-- >>> let null = Numeric.Interval.Kaucher.null+-- >>> let elem = Numeric.Interval.Kaucher.elem+-- >>> let notElem = Numeric.Interval.Kaucher.notElem  data Interval a = I !a !a deriving-  ( Eq, Ord-  , Data-  , Typeable-#if __GLASGOW_HASKELL__ >= 704-  , Generic-#if __GLASGOW_HASKELL__ >= 706-  , Generic1-#endif-#endif-  )+  (Eq, Ord, Data, Generic, Generic1) +-- | 'Data.Semigroup.<>' is 'hull'+instance Ord a => Data.Semigroup.Semigroup (Interval a) where+  (<>) = hull+ instance Functor Interval where   fmap f (I a b) = I (f a) (f b)   {-# INLINE fmap #-}  instance Foldable Interval where-  foldMap f (I a b) = f a `mappend` f b+  foldMap f (I a b) = f a `Data.Monoid.mappend` f b   {-# INLINE foldMap #-}  instance Traversable Interval where@@ -106,8 +99,10 @@   {-# INLINE (<*>) #-}  instance Monad Interval where+#if !(MIN_VERSION_base(4,11,0))   return a = I a a   {-# INLINE return #-}+#endif   I a b >>= f = I a' b' where     I a' _ = f a     I _ b' = f b@@ -662,6 +657,10 @@ -- -- >>> hull (15 ... 85 :: Interval Double) (0 ... 10 :: Interval Double) -- 0.0 ... 85.0+--+-- >>> hull (10 ... 20 :: Interval Double) (15 ... 0 :: Interval Double)+-- 10.0 ... 20.0+-- hull :: Ord a => Interval a -> Interval a -> Interval a hull x@(I a b) y@(I a' b')   | null x = y
src/Numeric/Interval/NonEmpty.hs view
@@ -1,9 +1,6 @@-{-# LANGUAGE CPP #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE DeriveDataTypeable #-}-#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE DeriveGeneric #-}-#endif ----------------------------------------------------------------------------- -- | -- Module      :  Numeric.Interval.NonEmpty@@ -41,8 +38,8 @@   , mignitude   , contains   , isSubsetOf-  , certainly, (<!), (<=!), (==!), (>=!), (>!)-  , possibly, (<?), (<=?), (==?), (>=?), (>?)+  , certainly, (<!), (<=!), (==!), (/=!), (>=!), (>!)+  , possibly, (<?), (<=?), (==?), (/=?), (>=?), (>?)   , clamp   , inflate, deflate   , scale, symmetric
src/Numeric/Interval/NonEmpty/Internal.hs view
@@ -1,9 +1,7 @@ {-# LANGUAGE CPP #-} {-# LANGUAGE Rank2Types #-} {-# LANGUAGE DeriveDataTypeable #-}-#if __GLASGOW_HASKELL__ >= 704 {-# LANGUAGE DeriveGeneric #-}-#endif {-# OPTIONS_HADDOCK not-home #-} ----------------------------------------------------------------------------- -- |@@ -40,8 +38,8 @@   , mignitude   , contains   , isSubsetOf-  , certainly, (<!), (<=!), (==!), (>=!), (>!)-  , possibly, (<?), (<=?), (==?), (>=?), (>?)+  , certainly, (<!), (<=!), (==!), (/=!), (>=!), (>!)+  , possibly, (<?), (<=?), (==?), (/=?), (>=?), (>?)   , clamp   , inflate, deflate   , scale, symmetric@@ -55,19 +53,17 @@  import Control.Exception as Exception import Data.Data-import Data.Foldable hiding (minimum, maximum, elem, notElem)-import Data.Monoid-#if __GLASGOW_HASKELL__ >= 704 import GHC.Generics-#endif-import Numeric.Interval.Exception import Prelude hiding (null, elem, notElem) +import qualified Data.Semigroup+ -- $setup -- >>> import Test.QuickCheck.Arbitrary -- >>> import Test.QuickCheck.Gen hiding (scale) -- >>> import Test.QuickCheck.Property -- >>> import Control.Applicative+-- >>> import Control.Exception -- >>> :set -XNoMonomorphismRestriction -- >>> :set -XExtendedDefaultRules -- >>> default (Integer,Double)@@ -78,22 +74,17 @@ -- >>> let conservativeExceptNaN sf f xs = forAll (choose (inf xs, sup xs)) $ \x -> isNaN (sf x) || (sf x) `member` (f xs) -- >>> let compose2 = fmap . fmap -- >>> let commutative op a b = (a `op` b) == (b `op` a)+--+-- >>> :set -Wno-deprecations+-- >>> let elem = Numeric.Interval.NonEmpty.Internal.elem+-- >>> let notElem = Numeric.Interval.NonEmpty.Internal.notElem  data Interval a = I !a !a deriving-  ( Eq, Ord-  , Data-  , Typeable-#if __GLASGOW_HASKELL__ >= 704-  , Generic-#if __GLASGOW_HASKELL__ >= 706-  , Generic1-#endif-#endif-  )+  (Eq, Ord, Data, Generic, Generic1) -instance Foldable Interval where-  foldMap f (I a b) = f a `mappend` f b-  {-# INLINE foldMap #-}+-- | 'Data.Semigroup.<>' is 'hull'+instance Ord a => Data.Semigroup.Semigroup (Interval a) where+  (<>) = hull  infix 3 ... @@ -432,8 +423,9 @@  -- | Fractional instance for intervals. ----- prop> ys /= singleton 0 ==> conservative2 ((/) :: Double -> Double -> Double) (/) xs ys--- prop> xs /= singleton 0 ==> conservative (recip :: Double -> Double) recip xs+-- -- The property tests below are currently disabled (#66).+-- -- prop> ys /= singleton 0 ==> conservative2 ((/) :: Double -> Double -> Double) (/) xs ys+-- -- prop> xs /= singleton 0 ==> conservative (recip :: Double -> Double) recip xs instance (Fractional a, Ord a) => Fractional (Interval a) where   -- TODO: check isNegativeZero properly   x / y@(I a b)@@ -492,7 +484,7 @@   cos = periodic (2 * pi) (symmetric 1) (signum' . negate . sin) cos   tan = periodic pi       whole         (const GT)               tan -- derivative only has to have correct sign   asin (I a b) = (asin' a) ... (asin' b)-    where +    where       asin' x | x >= 1 = halfPi               | x <= -1 = -halfPi               | otherwise = asin x@@ -801,7 +793,8 @@ -- >>> scale (-2.0) (-1.0 ... 1.0) -- -2.0 ... 2.0 ----- prop> abs x >= 1 ==> (scale (x :: Double) i) `contains` i+-- -- The property test below is currently disabled (#66).+-- -- prop> abs x >= 1 ==> (scale (x :: Double) i) `contains` i -- prop> forAll (choose (0,1)) $ \x -> abs x <= 1 ==> i `contains` (scale (x :: Double) i) scale :: (Fractional a, Ord a) => a -> Interval a -> Interval a scale x i = a ... b where
tests/doctests.hs view
@@ -7,19 +7,13 @@ -- Stability   :  provisional -- Portability :  portable ----- This module provides doctests for a project based on the actual versions--- of the packages it was built with. It requires a corresponding Setup.lhs--- to be added to the project+-- This module exists to add dependencies ----------------------------------------------------------------------------- module Main where -import Build_doctests (flags, pkgs, module_sources)-import Data.Foldable (traverse_)-import Test.DocTest- main :: IO () main = do-    traverse_ putStrLn args-    doctest args-  where-    args = flags ++ pkgs ++ module_sources+    putStrLn "This test-suite exists only to add dependencies"+    putStrLn "To run doctests: "+    putStrLn "    cabal build all --enable-tests"+    putStrLn "    cabal-docspec"