reducers 3.12.3 → 3.12.4
raw patch · 14 files changed
+154/−193 lines, 14 filesdep ~basedep ~bytestringdep ~containersPVP: major bump suggested
API removals or changes: PVP suggests a major version bump
Dependency ranges changed: base, bytestring, containers, hashable, semigroupoids, text, transformers
API changes (from Hackage documentation)
- Data.Generator: instance Data.Generator.Generator (Data.HashMap.Base.HashMap k v)
- Data.Generator: instance Data.Generator.Generator (Data.HashSet.HashSet a)
- Data.Generator: instance GHC.Arr.Ix i => Data.Generator.Generator (Data.Generator.Keys (GHC.Arr.Array i e))
- Data.Generator: instance GHC.Arr.Ix i => Data.Generator.Generator (GHC.Arr.Array i e)
- Data.Semigroup.Reducer: instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Data.Semigroup.Reducer.Reducer (k, v) (Data.HashMap.Base.HashMap k v)
- Data.Semigroup.Reducer: instance Data.Semigroup.Reducer.Reducer (GHC.Base.Maybe a) (Data.Monoid.First a)
- Data.Semigroup.Reducer: instance Data.Semigroup.Reducer.Reducer (GHC.Base.Maybe a) (Data.Monoid.Last a)
- Data.Semigroup.Union: instance (GHC.Classes.Eq a, Data.Hashable.Class.Hashable a) => Data.Semigroup.Union.HasUnion (Data.HashSet.HashSet a)
- Data.Semigroup.Union: instance (GHC.Classes.Eq a, Data.Hashable.Class.Hashable a) => Data.Semigroup.Union.HasUnion0 (Data.HashSet.HashSet a)
- Data.Semigroup.Union: instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Data.Semigroup.Union.HasUnion (Data.HashMap.Base.HashMap k a)
- Data.Semigroup.Union: instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Data.Semigroup.Union.HasUnion0 (Data.HashMap.Base.HashMap k a)
- Data.Semigroup.Union: instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Data.Semigroup.Union.HasUnionWith (Data.HashMap.Base.HashMap k)
- Data.Semigroup.Union: instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Data.Semigroup.Union.HasUnionWith0 (Data.HashMap.Base.HashMap k)
+ Data.Generator: instance Data.Generator.Generator (Data.HashMap.Internal.HashMap k v)
+ Data.Generator: instance Data.Generator.Generator (Data.HashSet.Internal.HashSet a)
+ Data.Generator: instance GHC.Ix.Ix i => Data.Generator.Generator (Data.Generator.Keys (GHC.Arr.Array i e))
+ Data.Generator: instance GHC.Ix.Ix i => Data.Generator.Generator (GHC.Arr.Array i e)
+ Data.Semigroup.Reducer: instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Data.Semigroup.Reducer.Reducer (k, v) (Data.HashMap.Internal.HashMap k v)
+ Data.Semigroup.Reducer: instance Data.Semigroup.Reducer.Reducer (GHC.Maybe.Maybe a) (Data.Monoid.First a)
+ Data.Semigroup.Reducer: instance Data.Semigroup.Reducer.Reducer (GHC.Maybe.Maybe a) (Data.Monoid.Last a)
+ Data.Semigroup.Union: instance (GHC.Classes.Eq a, Data.Hashable.Class.Hashable a) => Data.Semigroup.Union.HasUnion (Data.HashSet.Internal.HashSet a)
+ Data.Semigroup.Union: instance (GHC.Classes.Eq a, Data.Hashable.Class.Hashable a) => Data.Semigroup.Union.HasUnion0 (Data.HashSet.Internal.HashSet a)
+ Data.Semigroup.Union: instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Data.Semigroup.Union.HasUnion (Data.HashMap.Internal.HashMap k a)
+ Data.Semigroup.Union: instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Data.Semigroup.Union.HasUnion0 (Data.HashMap.Internal.HashMap k a)
+ Data.Semigroup.Union: instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Data.Semigroup.Union.HasUnionWith (Data.HashMap.Internal.HashMap k)
+ Data.Semigroup.Union: instance (GHC.Classes.Eq k, Data.Hashable.Class.Hashable k) => Data.Semigroup.Union.HasUnionWith0 (Data.HashMap.Internal.HashMap k)
Files
- .travis.yml +0/−158
- CHANGELOG.markdown +49/−0
- README.markdown +15/−0
- reducers.cabal +18/−10
- src/Data/Generator/Combinators.hs +6/−4
- src/Data/Semigroup/Alt.hs +8/−2
- src/Data/Semigroup/Alternative.hs +8/−2
- src/Data/Semigroup/Applicative.hs +10/−2
- src/Data/Semigroup/Apply.hs +4/−4
- src/Data/Semigroup/Generator.hs +10/−4
- src/Data/Semigroup/Monad.hs +10/−2
- src/Data/Semigroup/MonadPlus.hs +10/−5
- src/Data/Semigroup/Reducer.hs +2/−0
- src/Data/Semigroup/Union.hs +4/−0
− .travis.yml
@@ -1,158 +0,0 @@-# This Travis job script has been generated by a script via-#-# runghc make_travis_yml_2.hs '-o' '.travis.yml' '--ghc-head' '--irc-channel=irc.freenode.org#haskell-lens' '--no-no-tests-no-bench' '--no-unconstrained' 'cabal.project'-#-# For more information, see https://github.com/hvr/multi-ghc-travis-#-language: c-sudo: false--git:- submodules: false # whether to recursively clone submodules--notifications:- irc:- channels:- - "irc.freenode.org#haskell-lens"- skip_join: true- template:- - "\x0313reducers\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"--cache:- directories:- - $HOME/.cabal/packages- - $HOME/.cabal/store--before_cache:- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/build-reports.log- # remove files that are regenerated by 'cabal update'- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/00-index.*- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/*.json- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.cache- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar- - rm -fv $HOME/.cabal/packages/hackage.haskell.org/01-index.tar.idx-- - rm -rfv $HOME/.cabal/packages/head.hackage--matrix:- include:- - compiler: "ghc-8.6.1"- env: GHCHEAD=true- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-8.6.1], sources: [hvr-ghc]}}- - compiler: "ghc-8.4.3"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.4.3], sources: [hvr-ghc]}}- - compiler: "ghc-8.2.2"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.2.2], sources: [hvr-ghc]}}- - compiler: "ghc-8.0.2"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-8.0.2], sources: [hvr-ghc]}}- - compiler: "ghc-7.10.3"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.10.3], sources: [hvr-ghc]}}- - compiler: "ghc-7.8.4"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.8.4], sources: [hvr-ghc]}}- - compiler: "ghc-7.6.3"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.6.3], sources: [hvr-ghc]}}- - compiler: "ghc-7.4.2"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.4.2], sources: [hvr-ghc]}}- - compiler: "ghc-7.2.2"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.2.2], sources: [hvr-ghc]}}- - compiler: "ghc-7.0.4"- # env: TEST=--disable-tests BENCH=--disable-benchmarks- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-2.2,ghc-7.0.4], sources: [hvr-ghc]}}- - compiler: "ghc-head"- env: GHCHEAD=true- addons: {apt: {packages: [ghc-ppa-tools,cabal-install-head,ghc-head], sources: [hvr-ghc]}}-- allow_failures:- - compiler: "ghc-head"- - compiler: "ghc-7.0.4"- - compiler: "ghc-7.2.2"- - compiler: "ghc-8.6.1"--before_install:- - HC=${CC}- - HCPKG=${HC/ghc/ghc-pkg}- - unset CC- - ROOTDIR=$(pwd)- - mkdir -p $HOME/.local/bin- - "PATH=/opt/ghc/bin:/opt/ghc-ppa-tools/bin:$HOME/local/bin:$PATH"- - HCNUMVER=$(( $(${HC} --numeric-version|sed -E 's/([0-9]+)\.([0-9]+)\.([0-9]+).*/\1 * 10000 + \2 * 100 + \3/') ))- - echo $HCNUMVER--install:- - cabal --version- - echo "$(${HC} --version) [$(${HC} --print-project-git-commit-id 2> /dev/null || echo '?')]"- - BENCH=${BENCH---enable-benchmarks}- - TEST=${TEST---enable-tests}- - HADDOCK=${HADDOCK-true}- - UNCONSTRAINED=${UNCONSTRAINED-true}- - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false}- - GHCHEAD=${GHCHEAD-false}- - travis_retry cabal update -v- - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"- - rm -fv cabal.project cabal.project.local- # Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage- - |- if $GHCHEAD; then- sed -i 's/-- allow-newer: .*/allow-newer: *:base/' ${HOME}/.cabal/config- for pkg in $($HCPKG list --simple-output); do pkg=$(echo $pkg | sed 's/-[^-]*$//'); sed -i "s/allow-newer: /allow-newer: *:$pkg, /" ${HOME}/.cabal/config; done-- echo 'repository head.hackage' >> ${HOME}/.cabal/config- echo ' url: http://head.hackage.haskell.org/' >> ${HOME}/.cabal/config- echo ' secure: True' >> ${HOME}/.cabal/config- echo ' root-keys: 07c59cb65787dedfaef5bd5f987ceb5f7e5ebf88b904bbd4c5cbdeb2ff71b740' >> ${HOME}/.cabal/config- echo ' 2e8555dde16ebd8df076f1a8ef13b8f14c66bad8eafefd7d9e37d0ed711821fb' >> ${HOME}/.cabal/config- echo ' 8f79fd2389ab2967354407ec852cbe73f2e8635793ac446d09461ffb99527f6e' >> ${HOME}/.cabal/config- echo ' key-threshold: 3' >> ${HOME}/.cabal.config-- grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'-- cabal new-update head.hackage -v- fi- - grep -Ev -- '^\s*--' ${HOME}/.cabal/config | grep -Ev '^\s*$'- - "printf 'packages: \".\"\\n' > cabal.project"- - touch cabal.project.local- - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"- - cat cabal.project || true- - cat cabal.project.local || true- - if [ -f "./configure.ac" ]; then- (cd "." && autoreconf -i);- fi- - rm -f cabal.project.freeze- - cabal new-build -w ${HC} ${TEST} ${BENCH} --project-file="cabal.project" --dep -j2 all- - rm -rf .ghc.environment.* "."/dist- - DISTDIR=$(mktemp -d /tmp/dist-test.XXXX)--# 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:- # test that source-distributions can be generated- - (cd "." && cabal sdist)- - mv "."/dist/reducers-*.tar.gz ${DISTDIR}/- - cd ${DISTDIR} || false- - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;- - "printf 'packages: reducers-*/*.cabal\\n' > cabal.project"- - touch cabal.project.local- - "if ! $NOINSTALLEDCONSTRAINTS; then for pkg in $($HCPKG list --simple-output); do echo $pkg | sed 's/^/constraints: /' | sed 's/-[^-]*$/ installed/' >> cabal.project.local; done; fi"- - cat cabal.project || true- - cat cabal.project.local || true-- # build & run tests, build benchmarks- - cabal new-build -w ${HC} ${TEST} ${BENCH} all-- # cabal check- - (cd reducers-* && cabal check)-- # haddock- - rm -rf ./dist-newstyle- - if $HADDOCK; then cabal new-haddock -w ${HC} ${TEST} ${BENCH} all; else echo "Skipping haddock generation";fi--# REGENDATA ["-o",".travis.yml","--ghc-head","--irc-channel=irc.freenode.org#haskell-lens","--no-no-tests-no-bench","--no-unconstrained","cabal.project"]-# EOF
+ CHANGELOG.markdown view
@@ -0,0 +1,49 @@+3.12.4 [2021.11.01]+-------------------+* Allow building with GHC 9.2.+* Allow building with `transformers-0.6.*`.++3.12.3 [2018.07.03]+-------------------+* Fix some `RULES` warnings.+* Allow building with `containers-0.6`.++3.12.2+------+* Fix the build with `fingertree-0.1.2` or later. Since `fingertree-0.1.2` now+ provides a `Semigroup` instance for `FingerTree`, as a result+ `Data.Semigroup.Instances` no longer exports anything if building against+ `fingertree-0.1.2` or later with `base-4.9` or later.+* Removed a couple of redundant instance constraints+* GHC 8 compatibility+* `transformers` 0.5 compatibility++3.12.1+----+* Restored support for `semigroups` < 0.17.++3.12+----+* `semigroups` 0.17 support++3.11+----+* Fixed the name of the field accessor for Ap+* `semigroupoids` 5 support+* Builds without warnings on GHC 7.10++3.10+----+* Updated dependencies++3.0.2.1+-------+* Updated `array` dependency for compatibility with GHC 7.8++3.0.2+-----+* Claim to be Trustworthy++3.0.1+---+* Removed the upper bounds on my other package dependencies
+ README.markdown view
@@ -0,0 +1,15 @@+reducers+========++[](https://hackage.haskell.org/package/reducers) [](https://github.com/ekmett/reducers/actions?query=workflow%3AHaskell-CI)++This package provides a number of semigroup-based containers and reductions.++Contact Information+-------------------++Contributions and bug reports are welcome!++Please feel free to contact me through github or on the #haskell IRC channel on irc.freenode.net.++-Edward Kmett
reducers.cabal view
@@ -1,8 +1,8 @@ name: reducers category: Data, Math, Numerical, Semigroups-version: 3.12.3+version: 3.12.4 license: BSD3-cabal-version: >= 1.6+cabal-version: >= 1.10 license-file: LICENSE author: Edward A. Kmett maintainer: Edward A. Kmett <ekmett@gmail.com>@@ -13,7 +13,7 @@ synopsis: Semigroups, specialized containers and a general map/reduce framework description: Semigroups, specialized containers and a general map/reduce framework. build-type: Simple-extra-source-files: .travis.yml+extra-source-files: CHANGELOG.markdown README.markdown tested-with: GHC == 7.0.4 , GHC == 7.2.2 , GHC == 7.4.2@@ -22,8 +22,12 @@ , GHC == 7.10.3 , GHC == 8.0.2 , GHC == 8.2.2- , GHC == 8.4.3- , GHC == 8.6.1+ , GHC == 8.4.4+ , GHC == 8.6.5+ , GHC == 8.8.4+ , GHC == 8.10.7+ , GHC == 9.0.1+ , GHC == 9.2.1 source-repository head type: git@@ -35,16 +39,19 @@ build-depends: base >= 4 && < 5, array >= 0.3 && < 0.6,- transformers >= 0.2 && < 0.6,- bytestring >= 0.9.1 && < 0.11,+ transformers >= 0.2 && < 0.7,+ bytestring >= 0.9.1 && < 0.12, containers >= 0.3 && < 0.7, fingertree >= 0.1 && < 0.2,- hashable >= 1.1.2.1 && < 1.3,+ hashable >= 1.1.2.1 && < 1.4, text >= 0.11.1.5 && < 1.3, unordered-containers >= 0.2 && < 0.3,- semigroups >= 0.9 && < 1, semigroupoids >= 4 && < 6 + if impl(ghc < 8.0)+ build-depends:+ semigroups >= 0.9 && < 1+ exposed-modules: Data.Generator Data.Generator.Combinators@@ -62,10 +69,11 @@ Data.Semigroup.Self if impl(ghc)- extensions: DeriveDataTypeable+ default-extensions: DeriveDataTypeable cpp-options: -DLANGUAGE_DeriveDataTypeable ghc-options: -Wall+ default-language: Haskell2010 -- hack around the buggy unused matches check for class associated types in ghc 8 rc1 if impl(ghc >= 8)
src/Data/Generator/Combinators.hs view
@@ -57,18 +57,20 @@ , foldMap #endif )-import Control.Applicative+import Control.Applicative (Alternative) import Control.Monad (MonadPlus) import Data.Generator-#if __GLASGOW_HASKELL__ < 710-import Data.Monoid (Monoid(..))-#endif import Data.Semigroup (Sum(..), Product(..), All(..), Any(..), WrappedMonoid(..)) import Data.Semigroup.Applicative (Traversal(..)) import Data.Semigroup.Alternative (Alternate(..)) import Data.Semigroup.Monad (Action(..)) import Data.Semigroup.MonadPlus (MonadSum(..)) import Data.Semigroup.Reducer (Reducer(..))++#if !(MIN_VERSION_base(4,8,0))+import Control.Applicative (Applicative)+import Data.Monoid (Monoid(..))+#endif -- | Efficiently 'mapReduce' a 'Generator' using the 'Traversal' monoid. A specialized version of its namesake from "Data.Foldable" --
src/Data/Semigroup/Alt.hs view
@@ -22,11 +22,15 @@ ) where import Data.Functor.Plus-#if __GLASGOW_HASKELL__ < 710+import Data.Semigroup.Reducer (Reducer(..))++#if !(MIN_VERSION_base(4,8,0)) import Data.Monoid (Monoid(..)) #endif++#if !(MIN_VERSION_base(4,11,0)) import Data.Semigroup (Semigroup(..))-import Data.Semigroup.Reducer (Reducer(..))+#endif -- | A 'Alter' turns any 'Alt' instance into a 'Semigroup'. @@ -41,7 +45,9 @@ instance Plus f => Monoid (Alter f a) where mempty = zero+#if !(MIN_VERSION_base(4,11,0)) Alter a `mappend` Alter b = Alter (a <!> b)+#endif instance Alt f => Reducer (f a) (Alter f a) where unit = Alter
src/Data/Semigroup/Alternative.hs view
@@ -22,11 +22,15 @@ ) where import Control.Applicative-#if __GLASGOW_HASKELL__ < 710+import Data.Semigroup.Reducer (Reducer(..))++#if !(MIN_VERSION_base(4,8,0)) import Data.Monoid (Monoid(..)) #endif++#if !(MIN_VERSION_base(4,11,0)) import Data.Semigroup (Semigroup(..))-import Data.Semigroup.Reducer (Reducer(..))+#endif -- | A 'Alternate' turns any 'Alternative' instance into a 'Monoid'. @@ -38,7 +42,9 @@ instance Alternative f => Monoid (Alternate f a) where mempty = empty+#if !(MIN_VERSION_base(4,11,0)) Alternate a `mappend` Alternate b = Alternate (a <|> b)+#endif instance Alternative f => Reducer (f a) (Alternate f a) where unit = Alternate
src/Data/Semigroup/Applicative.hs view
@@ -24,11 +24,15 @@ ) where import Control.Applicative-#if __GLASGOW_HASKELL__ < 710+import Data.Semigroup.Reducer (Reducer(..))++#if !(MIN_VERSION_base(4,8,0)) import Data.Monoid (Monoid(..)) #endif++#if !(MIN_VERSION_base(4,11,0)) import Data.Semigroup (Semigroup(..))-import Data.Semigroup.Reducer (Reducer(..))+#endif -- | A 'Traversal' uses an glues together 'Applicative' actions with (*>) -- in the manner of 'traverse_' from "Data.Foldable". Any values returned by@@ -40,7 +44,9 @@ instance Applicative f => Monoid (Traversal f) where mempty = Traversal (pure ())+#if !(MIN_VERSION_base(4,11,0)) Traversal a `mappend` Traversal b = Traversal (a *> b)+#endif instance Applicative f => Reducer (f a) (Traversal f) where unit = Traversal . (() <$)@@ -62,7 +68,9 @@ instance (Applicative f, Monoid m) => Monoid (Ap f m) where mempty = pure mempty+#if !(MIN_VERSION_base(4,11,0)) mappend = liftA2 mappend+#endif instance (Applicative f, Reducer c m) => Reducer (f c) (Ap f m) where unit = fmap unit . Ap
src/Data/Semigroup/Apply.hs view
@@ -23,12 +23,12 @@ , App(..) ) where -#if __GLASGOW_HASKELL__ < 710-import Data.Functor-#endif import Data.Functor.Apply-import Data.Semigroup (Semigroup(..)) import Data.Semigroup.Reducer (Reducer(..))++#if !(MIN_VERSION_base(4,11,0))+import Data.Semigroup (Semigroup(..))+#endif -- | A 'Trav' uses an glues together 'Applicative' actions with (*>) -- in the manner of 'traverse_' from "Data.Foldable". Any values returned by
src/Data/Semigroup/Generator.hs view
@@ -29,13 +29,19 @@ , reduceWith1 ) where --- import Data.Monoid (Monoid(..))--- import Data.Foldable (fold,foldMap)-import Data.List.NonEmpty-import Data.Semigroup (Semigroup(..)) -- , WrappedMonoid(..))+import Data.List.NonEmpty (NonEmpty) import Data.Semigroup.Foldable import Data.Semigroup.Reducer import Data.Generator++-- #if !(MIN_VERSION_base(4,8,0))+-- import Data.Monoid (Monoid(..))+-- import Data.Foldable (fold,foldMap)+-- #endif++#if !(MIN_VERSION_base(4,11,0))+import Data.Semigroup (Semigroup(..)) -- , WrappedMonoid(..))+#endif -- | minimal definition 'mapReduce1' or 'mapTo1' class Generator c => Generator1 c where
src/Data/Semigroup/Monad.hs view
@@ -24,12 +24,16 @@ ) where import Control.Monad (liftM, liftM2)-#if __GLASGOW_HASKELL__ < 710+import Data.Semigroup.Reducer (Reducer(..))++#if !(MIN_VERSION_base(4,8,0)) import Control.Applicative (Applicative(..)) import Data.Monoid (Monoid(..)) #endif++#if !(MIN_VERSION_base(4,11,0)) import Data.Semigroup (Semigroup(..))-import Data.Semigroup.Reducer (Reducer(..))+#endif -- | A 'Action' uses an glues together monadic actions with (>>) -- in the manner of 'mapM_' from "Data.Foldable". Any values returned by@@ -41,7 +45,9 @@ instance Monad f => Monoid (Action f) where mempty = Action (return ())+#if !(MIN_VERSION_base(4,11,0)) Action a `mappend` Action b = Action (a >> b)+#endif instance Monad f => Reducer (f a) (Action f) where unit a = Action (a >> return ())@@ -63,7 +69,9 @@ instance (Monad f, Monoid m) => Monoid (Mon f m) where mempty = return mempty+#if !(MIN_VERSION_base(4,11,0)) mappend = liftM2 mappend+#endif instance (Monad f, Reducer c m) => Reducer (f c) (Mon f m) where unit = liftM unit . Mon
src/Data/Semigroup/MonadPlus.hs view
@@ -21,15 +21,18 @@ ( MonadSum(..) ) where +import Control.Applicative (Alternative(..)) import Control.Monad (MonadPlus(..))-#if __GLASGOW_HASKELL__ < 710-import Control.Applicative (Applicative(..),Alternative(..))+import Data.Semigroup.Reducer (Reducer(..))++#if !(MIN_VERSION_base(4,8,0))+import Control.Applicative (Applicative(..)) import Data.Monoid (Monoid(..))-#else-import Control.Applicative (Alternative(..)) #endif++#if !(MIN_VERSION_base(4,11,0)) import Data.Semigroup (Semigroup(..))-import Data.Semigroup.Reducer (Reducer(..))+#endif -- | A 'MonadSum' turns any 'MonadPlus' instance into a 'Monoid'. @@ -41,7 +44,9 @@ instance MonadPlus f => Monoid (MonadSum f a) where mempty = mzero+#if !(MIN_VERSION_base(4,11,0)) MonadSum a `mappend` MonadSum b = MonadSum (mplus a b)+#endif instance MonadPlus f => Reducer (f a) (MonadSum f a) where unit = MonadSum
src/Data/Semigroup/Reducer.hs view
@@ -132,7 +132,9 @@ instance Monoid Count where mempty = Count 0+#if !(MIN_VERSION_base(4,11,0)) Count a `mappend` Count b = Count (a + b)+#endif instance Reducer a Count where unit _ = Count 1
src/Data/Semigroup/Union.hs view
@@ -115,7 +115,9 @@ Union a <> Union b = Union (a `union` b) instance HasUnion0 f => Monoid (Union f) where+#if !(MIN_VERSION_base(4,11,0)) Union a `mappend` Union b = Union (a `union` b)+#endif mempty = Union empty instance HasUnion f => Reducer f (Union f) where@@ -173,7 +175,9 @@ instance (HasUnionWith0 f, Monoid m) => Monoid (UnionWith f m) where mempty = UnionWith emptyWith+#if !(MIN_VERSION_base(4,11,0)) UnionWith a `mappend` UnionWith b = UnionWith (unionWith mappend a b)+#endif instance (HasUnionWith f, Semigroup m, Monoid m) => Reducer (f m) (UnionWith f m) where unit = UnionWith