packages feed

semigroupoids 5.2.2 → 5.3

raw patch · 11 files changed

+286/−48 lines, 11 filesdep ~basedep ~base-orphansdep ~containers

Dependency ranges changed: base, base-orphans, containers

Files

.gitignore view
@@ -1,3 +1,4 @@+.ghc.environment.* dist docs wiki
.travis.yml view
@@ -1,6 +1,6 @@ # This Travis job script has been generated by a script via #-#   runghc make_travis_yml_2.hs '-o' '.travis.yml' '--irc-channel=irc.freenode.org#haskell-lens' '--no-no-tests-no-bench' '--no-installed' 'cabal.project'+#   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 #@@ -36,42 +36,45 @@  matrix:   include:-    - compiler: "ghc-7.0.4"+    - 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: [*apt_packages,cabal-install-2.0,ghc-7.0.4], sources: [hvr-ghc]}}-    - compiler: "ghc-7.2.2"+      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: [*apt_packages,cabal-install-2.0,ghc-7.2.2], sources: [hvr-ghc]}}-    - compiler: "ghc-7.4.2"+      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: [*apt_packages,cabal-install-2.0,ghc-7.4.2], sources: [hvr-ghc]}}-    - compiler: "ghc-7.6.3"+      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: [*apt_packages,cabal-install-2.0,ghc-7.6.3], sources: [hvr-ghc]}}+      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: [*apt_packages,cabal-install-2.0,ghc-7.8.4], sources: [hvr-ghc]}}-    - compiler: "ghc-7.10.3"+      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: [*apt_packages,cabal-install-2.0,ghc-7.10.3], sources: [hvr-ghc]}}-    - compiler: "ghc-8.0.2"+      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: [*apt_packages,cabal-install-2.0,ghc-8.0.2], sources: [hvr-ghc]}}-    - compiler: "ghc-8.2.2"+      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: [*apt_packages,cabal-install-2.0,ghc-8.2.2], sources: [hvr-ghc]}}-    - compiler: "ghc-8.4.1"-      env: GHCHEAD=true-      addons: {apt: {packages: [*apt_packages,cabal-install-head,ghc-8.4.1], sources: [hvr-ghc]}}+      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: [*apt_packages,cabal-install-head,ghc-head], sources: [hvr-ghc]}}+      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.4.1"-    - compiler: "ghc-head"+    - compiler: "ghc-8.6.1"  before_install:   - HC=${CC}@@ -89,7 +92,8 @@   - BENCH=${BENCH---enable-benchmarks}   - TEST=${TEST---enable-tests}   - HADDOCK=${HADDOCK-true}-  - INSTALLED=${INSTALLED-true}+  - UNCONSTRAINED=${UNCONSTRAINED-true}+  - NOINSTALLEDCONSTRAINTS=${NOINSTALLEDCONSTRAINTS-false}   - GHCHEAD=${GHCHEAD-false}   - travis_retry cabal update -v   - "sed -i.bak 's/^jobs:/-- jobs:/' ${HOME}/.cabal/config"@@ -97,7 +101,8 @@   # Overlay Hackage Package Index for GHC HEAD: https://github.com/hvr/head.hackage   - |     if $GHCHEAD; then-      sed -i.bak 's/-- allow-newer:.*/allow-newer: *:base, *:template-haskell, *:ghc, *:Cabal/' ${HOME}/.cabal/config+      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@@ -107,17 +112,22 @@       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"-  - cat 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+  - 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;@@ -129,8 +139,10 @@   - cd ${DISTDIR} || false   - find . -maxdepth 1 -name '*.tar.gz' -exec tar -xvf '{}' \;   - "printf 'packages: semigroupoids-*/*.cabal\\n' > cabal.project"-  - cat 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@@ -143,5 +155,5 @@   - 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","--irc-channel=irc.freenode.org#haskell-lens","--no-no-tests-no-bench","--no-installed","cabal.project"]+# 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
@@ -1,3 +1,11 @@+5.3+---+* Allow building with `containers-0.6`.+* Add `Alt` instances for `First` and `Last` from `Data.Semigroup`, and+  `Alt` and `Plus` instances for `First` and `Last` from `Data.Monoid`.+* Add missing `Apply`, `Bind`, `Extend`, `Foldable1` and `Traversable1`+  instances for `Data.Semigroups`, `Data.Monoid` and `GHC.Generics`.+ 5.2.2 [2018.01.18] ------------------ * Add `optional` to `Data.Functor.Alt` (analogous to the `optional` function@@ -7,6 +15,8 @@   definitions in terms of the other. * Allow building with GHC 8.4 * `Apply` and `Bind` instances for `Q`, from the `template-haskell` package.+  (As a consequence, `Data.Semigroup.Foldable` is no longer a `Trustworthy`+  module.) * Add instances for `(:~:)` and `(:~~:)` from `Data.Type.Equality`, and   `Coercion` from `Data.Type.Coercion` 
semigroupoids.cabal view
@@ -1,6 +1,6 @@ name:          semigroupoids category:      Control, Comonads-version:       5.2.2+version:       5.3 license:       BSD3 cabal-version: >= 1.8 license-file:  LICENSE@@ -18,7 +18,8 @@              , GHC == 7.10.3              , GHC == 8.0.2              , GHC == 8.2.2-             , GHC == 8.4.1+             , GHC == 8.4.3+             , GHC == 8.6.1 build-type:    Custom synopsis:      Semigroupoids: Category sans id extra-source-files:@@ -137,12 +138,12 @@ library   build-depends:     base                >= 4.3     && < 5,-    base-orphans        >= 0.5.4   && < 1,+    base-orphans        >= 0.8     && < 1,     bifunctors          >= 5       && < 6,     semigroups          >= 0.8.3.1 && < 1,     template-haskell,     transformers        >= 0.2     && < 0.6,-    transformers-compat >= 0.5     && < 0.6+    transformers-compat >= 0.5     && < 0.7    if impl(ghc >= 7.0 && < 7.2)     build-depends: generic-deriving >= 1.11 && < 1.13@@ -151,7 +152,7 @@     build-depends: ghc-prim    if flag(containers)-    build-depends: containers >= 0.3 && < 0.6+    build-depends: containers >= 0.3 && < 0.7    if flag(contravariant)     build-depends: contravariant >= 0.2.0.1 && < 2@@ -207,5 +208,5 @@   else     build-depends:       base      >= 4      && < 5,-      doctest   >= 0.11.1 && < 0.14,+      doctest   >= 0.11.1 && < 0.17,       semigroupoids
src/Data/Functor/Alt.hs view
@@ -52,7 +52,9 @@ import Data.Functor.Product import Data.Functor.Reverse import Data.List.NonEmpty (NonEmpty(..))+import qualified Data.Monoid as Monoid import Data.Semigroup (Option(..), Semigroup(..))+import qualified Data.Semigroup as Semigroup import Prelude (($),Either(..),Maybe(..),const,IO,Ord,(++),(.),either,seq,undefined) import Unsafe.Coerce @@ -268,3 +270,15 @@  instance Alt f => Alt (Reverse f) where   Reverse a <!> Reverse b = Reverse (a <!> b)++instance Alt Semigroup.First where+  (<!>) = (<>)++instance Alt Semigroup.Last where+  (<!>) = (<>)++instance Alt Monoid.First where+  (<!>) = mappend++instance Alt Monoid.Last where+  (<!>) = mappend
src/Data/Functor/Bind/Class.hs view
@@ -1,4 +1,10 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE GeneralizedNewtypeDeriving #-}+{-# LANGUAGE StandaloneDeriving #-}+{-# LANGUAGE TypeOperators #-}+#if __GLASGOW_HASKELL__ >= 708+{-# LANGUAGE EmptyCase #-}+#endif  #ifndef MIN_VERSION_semigroups #define MIN_VERSION_semigroups(x,y,z) 1@@ -18,7 +24,7 @@  ----------------------------------------------------------------------------- -- |--- Copyright   :  (C) 2011-2015 Edward Kmett+-- Copyright   :  (C) 2011-2018 Edward Kmett -- License     :  BSD-style (see the file LICENSE) -- -- Maintainer  :  Edward Kmett <ekmett@gmail.com>@@ -79,10 +85,20 @@ import Data.Functor.Reverse import Data.Functor.Extend import Data.List.NonEmpty+import Data.Semigroup as Semigroup+import Data.Monoid as Monoid hiding ((<>)) import Data.Orphans ()+import GHC.Generics as Generics import Language.Haskell.TH (Q) import Prelude hiding (id, (.)) +#if MIN_VERSION_base(4,6,0)+import Data.Ord (Down (..))+#else+import GHC.Exts (Down (..))+#endif++ #if MIN_VERSION_base(4,4,0) import Data.Complex #endif@@ -428,6 +444,46 @@   Cokleisli f <.> Cokleisli a = Cokleisli (\w -> (f w) (a w)) #endif +instance Apply Down where (<.>)=(<*>);(.>)=(*>);(<.)=(<*)++instance Apply Monoid.Sum where (<.>)=(<*>);(.>)=(*>);(<.)=(<*)+instance Apply Monoid.Product where (<.>)=(<*>);(.>)=(*>);(<.)=(<*)+instance Apply Monoid.Dual where (<.>)=(<*>);(.>)=(*>);(<.)=(<*)+instance Apply Monoid.First where (<.>)=(<*>);(.>)=(*>);(<.)=(<*)+instance Apply Monoid.Last where (<.>)=(<*>);(.>)=(*>);(<.)=(<*)+#if MIN_VERSION_base(4,8,0)+deriving instance Apply f => Apply (Monoid.Alt f)+#endif+-- in GHC 8.6 we'll have to deal with Apply f => Apply (Ap f) the same way+instance Apply Semigroup.First where (<.>)=(<*>);(.>)=(*>);(<.)=(<*)+instance Apply Semigroup.Last where (<.>)=(<*>);(.>)=(*>);(<.)=(<*)+instance Apply Semigroup.Min where (<.>)=(<*>);(.>)=(*>);(<.)=(<*)+instance Apply Semigroup.Max where (<.>)=(<*>);(.>)=(*>);(<.)=(<*)++instance (Apply f, Apply g) => Apply (f :*: g) where+  (a :*: b) <.> (c :*: d) = (a <.> c) :*: (b <.> d)++deriving instance Apply f => Apply (M1 i t f)+deriving instance Apply f => Apply (Rec1 f)++instance (Apply f, Apply g) => Apply (f :.: g) where+  Comp1 m <.> Comp1 n = Comp1 $ (<.>) <$> m <.> n++instance Apply U1 where (<.>)=(<*>);(.>)=(*>);(<.)=(<*)++instance Semigroup c => Apply (K1 i c) where+  K1 a <.> K1 b = K1 (a <> b)+  K1 a <.  K1 b = K1 (a <> b)+  K1 a  .> K1 b = K1 (a <> b)+instance Apply Par1 where (<.>)=(<*>);(.>)=(*>);(<.)=(<*)++instance Apply Generics.V1 where+#if __GLASGOW_HASKELL__ >= 708+  e <.> _ = case e of {}+#else+  e <.> _ = e `seq` undefined+#endif+ -- | A 'Monad' sans 'return'. -- -- Minimal definition: Either 'join' or '>>-'@@ -622,6 +678,29 @@       Nothing -> [] #endif +instance Bind Down where Down a >>- f = f a++instance Bind Monoid.Sum where (>>-) = (>>=)+instance Bind Monoid.Product where (>>-) = (>>=)+instance Bind Monoid.Dual where (>>-) = (>>=)+instance Bind Monoid.First where (>>-) = (>>=)+instance Bind Monoid.Last where (>>-) = (>>=)+#if MIN_VERSION_base(4,8,0)+instance Bind f => Bind (Monoid.Alt f) where+  Alt m >>- k = Alt (m >>- getAlt . k)+#endif+-- in GHC 8.6 we'll have to deal with Bind f => Bind (Ap f) the same way+instance Bind Semigroup.First where (>>-) = (>>=)+instance Bind Semigroup.Last where (>>-) = (>>=)+instance Bind Semigroup.Min where (>>-) = (>>=)+instance Bind Semigroup.Max where (>>-) = (>>=)+instance Bind Generics.V1 where+#if __GLASGOW_HASKELL__ >= 708+  m >>- _ = case m of {}+#else+  m >>- _ = m `seq` undefined+#endif+ infixl 4 <<.>>, <<., .>>  class Bifunctor p => Biapply p where@@ -711,4 +790,3 @@ instance Biapply p => Biapply (WrappedBifunctor p) where   WrapBifunctor fg <<.>> WrapBifunctor xy = WrapBifunctor (fg <<.>> xy)   {-# INLINE (<<.>>) #-}-
src/Data/Functor/Extend.hs view
@@ -1,8 +1,13 @@ {-# LANGUAGE CPP #-}+{-# LANGUAGE TypeOperators #-}  #if __GLASGOW_HASKELL__ >= 702 && __GLASGOW_HASKELL <= 706 && defined(MIN_VERSION_comonad) && !(MIN_VERSION_comonad(3,0,3)) {-# LANGUAGE Trustworthy #-} #endif++#if __GLASGOW_HASKELL__ >= 708+{-# LANGUAGE EmptyCase #-}+#endif ----------------------------------------------------------------------------- -- | -- Module      :  Data.Functor.Extend@@ -24,8 +29,7 @@ import Control.Category import Control.Monad.Trans.Identity import Data.Functor.Identity-import Data.Functor.Sum (Sum(..))-import Data.Semigroup (Semigroup(..))+import Data.Functor.Sum as Functor (Sum(..)) import Data.List (tails) import Data.List.NonEmpty (NonEmpty(..), toList) @@ -50,6 +54,10 @@ import Data.Proxy #endif +import Data.Orphans ()+import GHC.Generics as Generics+import Data.Monoid as Monoid hiding ((<>))+import Data.Semigroup as Semigroup  class Functor w => Extend w where   -- |@@ -155,9 +163,59 @@       []     -> []       (a:as) -> toList (extended f (a :| as)) -instance (Extend f, Extend g) => Extend (Sum f g) where+instance (Extend f, Extend g) => Extend (Functor.Sum f g) where   extended f (InL l) = InL (extended (f . InL) l)   extended f (InR r) = InR (extended (f . InR) r)++instance (Extend f, Extend g) => Extend (f :+: g) where+  extended f (L1 l) = L1 (extended (f . L1) l)+  extended f (R1 r) = R1 (extended (f . R1) r)++instance Extend Generics.U1 where+  extended _ U1 = U1++instance Extend Generics.V1 where+#if __GLASGOW_HASKELL__ >= 708+  extended _ e = case e of {}+#else+  extended _ e = seq e undefined+#endif++instance Extend f => Extend (Generics.M1 i t f) where+  extended f = M1 . extended (f . M1) . unM1++instance Extend Par1 where+  extended f w@Par1{} = Par1 (f w)++instance Extend f => Extend (Rec1 f) where+  extended f = Rec1 . extended (f . Rec1) . unRec1++instance Extend Monoid.Sum where+  extended f w@Monoid.Sum{} = Monoid.Sum (f w)++instance Extend Monoid.Product where+  extended f w@Monoid.Product{} = Monoid.Product (f w)++instance Extend Monoid.Dual where+  extended f w@Monoid.Dual{} = Monoid.Dual (f w)++#if MIN_VERSION_base(4,8,0)+instance Extend f => Extend (Monoid.Alt f) where+  extended f = Monoid.Alt . extended (f . Monoid.Alt) . Monoid.getAlt+#endif++-- in GHC 8.6 we'll have to deal with Apply f => Apply (Ap f) the same way+instance Extend Semigroup.First where+  extended f w@Semigroup.First{} = Semigroup.First (f w)++instance Extend Semigroup.Last where+  extended f w@Semigroup.Last{} = Semigroup.Last (f w)++instance Extend Semigroup.Min where+  extended f w@Semigroup.Min{} = Semigroup.Min (f w)++instance Extend Semigroup.Max where+  extended f w@Semigroup.Max{} = Semigroup.Max (f w)  -- $definition -- There are two ways to define an 'Extend' instance:
src/Data/Functor/Plus.hs view
@@ -44,6 +44,7 @@ import Data.Functor.Compose import Data.Functor.Product import Data.Functor.Reverse+import qualified Data.Monoid as Monoid import Data.Semigroup hiding (Product) import Prelude hiding (id, (.)) @@ -172,3 +173,9 @@  instance Plus f => Plus (Reverse f) where   zero = Reverse zero++instance Plus Monoid.First where+  zero = Monoid.First Nothing++instance Plus Monoid.Last where+  zero = Monoid.Last Nothing
src/Data/Semigroup/Foldable/Class.hs view
@@ -33,12 +33,12 @@ import Data.Bifunctor.Tannen import Data.Bifunctor.Wrapped import Data.Foldable-import Data.Functor.Compose  import Data.Functor.Identity import Data.Functor.Product as Functor import Data.Functor.Reverse-import Data.Functor.Sum+import Data.Functor.Sum as Functor+import Data.Functor.Compose import Data.List.NonEmpty (NonEmpty(..))  #if MIN_VERSION_base(4,4,0)@@ -55,7 +55,10 @@ import Data.Tree #endif -import Data.Semigroup hiding (Product, Sum)+import Data.Monoid as Monoid hiding ((<>))+import Data.Semigroup as Semigroup hiding (Product, Sum)+import Data.Orphans ()+-- import Data.Ord -- missing Foldable, https://ghc.haskell.org/trac/ghc/ticket/15098#ticket  #ifdef MIN_VERSION_generic_deriving import Generics.Deriving.Base@@ -74,6 +77,32 @@   fold1 = foldMap1 id   toNonEmpty = foldMap1 (:|[]) +instance Foldable1 Monoid.Sum where+  foldMap1 f (Monoid.Sum a) = f a++instance Foldable1 Monoid.Product where+  foldMap1 f (Monoid.Product a) = f a++instance Foldable1 Monoid.Dual where+  foldMap1 f (Monoid.Dual a) = f a++#if MIN_VERSION_base(4,8,0)+instance Foldable1 f => Foldable1 (Monoid.Alt f) where+  foldMap1 g (Alt m) = foldMap1 g m+#endif++instance Foldable1 Semigroup.First where+  foldMap1 f (Semigroup.First a) = f a++instance Foldable1 Semigroup.Last where+  foldMap1 f (Semigroup.Last a) = f a++instance Foldable1 Semigroup.Min where+  foldMap1 f (Semigroup.Min a) = f a++instance Foldable1 Semigroup.Max where+  foldMap1 f (Semigroup.Max a) = f a+ instance Foldable1 f => Foldable1 (Rec1 f) where   foldMap1 f (Rec1 as) = foldMap1 f as @@ -212,9 +241,9 @@ instance Foldable1 f => Foldable1 (Reverse f) where   foldMap1 f = getDual . foldMap1 (Dual . f) . getReverse -instance (Foldable1 f, Foldable1 g) => Foldable1 (Sum f g) where-  foldMap1 f (InL x) = foldMap1 f x-  foldMap1 f (InR y) = foldMap1 f y+instance (Foldable1 f, Foldable1 g) => Foldable1 (Functor.Sum f g) where+  foldMap1 f (Functor.InL x) = foldMap1 f x+  foldMap1 f (Functor.InR y) = foldMap1 f y  instance Foldable1 NonEmpty where   foldMap1 f (a :| []) = f a
src/Data/Semigroup/Traversable/Class.hs view
@@ -36,7 +36,9 @@ import Data.Functor.Reverse import Data.Functor.Sum as Functor import Data.List.NonEmpty (NonEmpty(..))-import Data.Semigroup+import Data.Monoid as Monoid hiding ((<>))+import Data.Orphans ()+import Data.Semigroup as Semigroup import Data.Semigroup.Foldable import Data.Semigroup.Bifoldable #ifdef MIN_VERSION_tagged@@ -231,3 +233,29 @@ instance Traversable1 g => Traversable1 (Joker g a) where   traverse1 g = fmap Joker . traverse1 g . runJoker   {-# INLINE traverse1 #-}++instance Traversable1 Monoid.Sum where+  traverse1 g (Monoid.Sum a) = Monoid.Sum <$> g a++instance Traversable1 Monoid.Product where+  traverse1 g (Monoid.Product a) = Monoid.Product <$> g a++instance Traversable1 Monoid.Dual where+  traverse1 g (Monoid.Dual a) = Monoid.Dual <$> g a++#if MIN_VERSION_base(4,8,0)+instance Traversable1 f => Traversable1 (Monoid.Alt f) where+  traverse1 g (Alt m) = Alt <$> traverse1 g m+#endif++instance Traversable1 Semigroup.First where+  traverse1 g (Semigroup.First a) = Semigroup.First <$> g a++instance Traversable1 Semigroup.Last where+  traverse1 g (Semigroup.Last a) = Semigroup.Last <$> g a++instance Traversable1 Semigroup.Min where+  traverse1 g (Semigroup.Min a) = Semigroup.Min <$> g a++instance Traversable1 Semigroup.Max where+  traverse1 g (Semigroup.Max a) = Semigroup.Max <$> g a
src/Data/Traversable/Instances.hs view
@@ -1,6 +1,6 @@ ----------------------------------------------------------------------------- -- |--- Copyright   :  (C) 2011-2015 Edward Kmett+-- Copyright   :  (C) 2011-2015,2018 Edward Kmett -- License     :  BSD-style (see the file LICENSE) -- -- Maintainer  :  Edward Kmett <ekmett@gmail.com>