packages feed

heaps 0.3.1 → 0.3.2

raw patch · 4 files changed

+101/−27 lines, 4 filesdep ~base

Dependency ranges changed: base

Files

.travis.yml view
@@ -1,4 +1,58 @@-language: haskell+# NB: don't set `language: haskell` here++# See also https://github.com/hvr/multi-ghc-travis for more information+env:+ # we have to use CABALVER=1.16 for GHC<7.6 as well, as there's+ # no package for earlier cabal versions in the PPA+ - GHCVER=7.4.2 CABALVER=1.16+ - GHCVER=7.6.3 CABALVER=1.16+ - GHCVER=7.8.4 CABALVER=1.18+ - GHCVER=7.10.1 CABALVER=1.22+ - GHCVER=head CABALVER=1.22++matrix:+  allow_failures:+   - env: GHCVER=head CABALVER=1.22++# 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+ - export PATH=/opt/ghc/$GHCVER/bin:/opt/cabal/$CABALVER/bin:$PATH+ - cabal --version++install:+ - travis_retry cabal update+ - cabal install --only-dependencies+ - travis_retry sudo apt-get -q -y install hlint || cabal install hlint++# 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 -v2++ # this builds all libraries and executables+ # (including tests/benchmarks)+ - cabal build++ # tests that a source-distribution can be generated+ - cabal sdist+ - hlint src --cpp-define HLINT++ # 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:
CHANGELOG.markdown view
@@ -1,3 +1,8 @@+0.3.2+-----+* Build without warnings on GHC 7.10+* Overload Foldable `null` and `length` on GHC 7.10++ 0.3.1 ----- * Explicit nominal role annotation
heaps.cabal view
@@ -1,5 +1,5 @@ name:           heaps-version:        0.3.1+version:        0.3.2 license:        BSD3 license-file:   LICENSE author:         Edward A. Kmett@@ -11,6 +11,7 @@ synopsis:       Asymptotically optimal Brodal/Okasaki heaps. description:    Asymptotically optimal Brodal/Okasaki bootstrapped skew-binomial heaps from the paper <http://citeseerx.ist.psu.edu/viewdoc/summary?doi=10.1.1.48.973 "Optimal Purely Functional Priority Queues">, extended with a 'Foldable' interface. copyright:      (c) 2010 Edward A. Kmett+tested-with:    GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.0.20150307 build-type:     Simple cabal-version:  >=1.8 extra-source-files: .travis.yml CHANGELOG.markdown README.markdown
src/Data/Heap.hs view
@@ -79,10 +79,15 @@     ) where  import Prelude hiding-    ( map, null+    ( map     , span, dropWhile, takeWhile, break, filter, take, drop, splitAt     , foldr, minimum, replicate, mapM     , concatMap+#if __GLASGOW_HASKELL__ < 710+    , null+#else+    , traverse+#endif     ) import qualified Data.List as L import Control.Applicative (Applicative(pure))@@ -163,31 +168,7 @@       go f (_:_) [] = GT  --- | /O(1)/. Is the heap empty?------ >>> null empty--- True------ >>> null (singleton "hello")--- False-null :: Heap a -> Bool-null Empty = True-null _ = False-{-# INLINE null #-} --- | /O(1)/. The number of elements in the heap.------ >>> size empty--- 0--- >>> size (singleton "hello")--- 1--- >>> size (fromList [4,1,2])--- 3-size :: Heap a -> Int-size Empty = 0-size (Heap s _ _) = s-{-# INLINE size #-}- -- | /O(1)/. The empty heap -- -- @'empty' ≡ 'fromList' []@@@ -414,6 +395,39 @@ instance Foldable Heap where   foldMap _ Empty = mempty   foldMap f l@(Heap _ _ t) = f (root t) `mappend` foldMap f (deleteMin l)+#if __GLASGOW_HASKELL__ >= 710+  null Empty = True+  null _ = False++  length = size+#else++-- | /O(1)/. Is the heap empty?+--+-- >>> null empty+-- True+--+-- >>> null (singleton "hello")+-- False+null :: Heap a -> Bool+null Empty = True+null _ = False+{-# INLINE null #-}++#endif++-- | /O(1)/. The number of elements in the heap.+--+-- >>> size empty+-- 0+-- >>> size (singleton "hello")+-- 1+-- >>> size (fromList [4,1,2])+-- 3+size :: Heap a -> Int+size Empty = 0+size (Heap s _ _) = s+{-# INLINE size #-}  -- | /O(n)/. Map a function over the heap, returning a new heap ordered appropriately for its fresh contents --