bifunctors 4.2.1 → 5
raw patch · 20 files changed
+232/−491 lines, 20 filesdep −semigroupoidsdep ~basePVP ok
version bump matches the API change (PVP)
Dependencies removed: semigroupoids
Dependency ranges changed: base
API changes (from Hackage documentation)
- Data.Bifunctor.Apply: (.>>) :: Biapply p => p a b -> p c d -> p c d
- Data.Bifunctor.Apply: (<<$>>) :: (a -> b) -> a -> b
- Data.Bifunctor.Apply: (<<.) :: Biapply p => p a b -> p c d -> p a b
- Data.Bifunctor.Apply: (<<..>>) :: Biapply p => p a c -> p (a -> b) (c -> d) -> p b d
- Data.Bifunctor.Apply: (<<.>>) :: Biapply p => p (a -> b) (c -> d) -> p a c -> p b d
- Data.Bifunctor.Apply: bilift2 :: Biapply w => (a -> b -> c) -> (d -> e -> f) -> w a d -> w b e -> w c f
- Data.Bifunctor.Apply: bilift3 :: Biapply w => (a -> b -> c -> d) -> (e -> f -> g -> h) -> w a e -> w b f -> w c g -> w d h
- Data.Bifunctor.Apply: class Bifunctor p => Biapply p where a .>> b = bimap (const id) (const id) <<$>> a <<.>> b a <<. b = bimap const const <<$>> a <<.>> b
- Data.Bifunctor.Apply: instance (Semigroup x, Semigroup y) => Biapply ((,,,) x y)
- Data.Bifunctor.Apply: instance (Semigroup x, Semigroup y, Semigroup z) => Biapply ((,,,,) x y z)
- Data.Bifunctor.Apply: instance Biapply (,)
- Data.Bifunctor.Apply: instance Biapply Arg
- Data.Bifunctor.Apply: instance Biapply Const
- Data.Bifunctor.Apply: instance Biapply Tagged
- Data.Bifunctor.Apply: instance Semigroup x => Biapply ((,,) x)
- Data.Bifunctor.Biff: instance (Biapply p, Apply f, Apply g) => Biapply (Biff p f g)
- Data.Bifunctor.Biff: instance (Bifoldable1 p, Foldable1 f, Foldable1 g) => Bifoldable1 (Biff p f g)
- Data.Bifunctor.Biff: instance (Bitraversable1 p, Traversable1 f, Traversable1 g) => Bitraversable1 (Biff p f g)
- Data.Bifunctor.Clown: instance Apply f => Biapply (Clown f)
- Data.Bifunctor.Clown: instance Foldable1 f => Bifoldable1 (Clown f)
- Data.Bifunctor.Clown: instance Traversable1 f => Bitraversable1 (Clown f)
- Data.Bifunctor.Flip: instance Biapply p => Biapply (Flip p)
- Data.Bifunctor.Flip: instance Bifoldable1 p => Bifoldable1 (Flip p)
- Data.Bifunctor.Flip: instance Bitraversable1 p => Bitraversable1 (Flip p)
- Data.Bifunctor.Join: instance Biapply p => Apply (Join p)
- Data.Bifunctor.Join: instance Bifoldable1 p => Foldable1 (Join p)
- Data.Bifunctor.Join: instance Bitraversable1 p => Traversable1 (Join p)
- Data.Bifunctor.Joker: instance Apply g => Biapply (Joker g)
- Data.Bifunctor.Joker: instance Foldable1 g => Bifoldable1 (Joker g)
- Data.Bifunctor.Joker: instance Foldable1 g => Foldable1 (Joker g a)
- Data.Bifunctor.Joker: instance Traversable1 g => Bitraversable1 (Joker g)
- Data.Bifunctor.Joker: instance Traversable1 g => Traversable1 (Joker g a)
- Data.Bifunctor.Product: instance (Bifoldable1 f, Bifoldable1 g) => Bifoldable1 (Product f g)
- Data.Bifunctor.Product: instance (Bitraversable1 f, Bitraversable1 g) => Bitraversable1 (Product f g)
- Data.Bifunctor.Tannen: instance (Apply f, Biapply p) => Biapply (Tannen f p)
- Data.Bifunctor.Tannen: instance (Foldable1 f, Bifoldable1 p) => Bifoldable1 (Tannen f p)
- Data.Bifunctor.Tannen: instance (Traversable1 f, Bitraversable1 p) => Bitraversable1 (Tannen f p)
- Data.Bifunctor.Wrapped: instance Biapply p => Biapply (WrappedBifunctor p)
- Data.Bifunctor.Wrapped: instance Bifoldable1 p => Bifoldable1 (WrappedBifunctor p)
- Data.Bifunctor.Wrapped: instance Bitraversable1 p => Bitraversable1 (WrappedBifunctor p)
- Data.Semigroup.Bifoldable: bifold1 :: (Bifoldable1 t, Semigroup m) => t m m -> m
- Data.Semigroup.Bifoldable: bifoldMap1 :: (Bifoldable1 t, Semigroup m) => (a -> m) -> (b -> m) -> t a b -> m
- Data.Semigroup.Bifoldable: bifoldMapDefault1 :: (Bifoldable1 t, Monoid m) => (a -> m) -> (b -> m) -> t a b -> m
- Data.Semigroup.Bifoldable: bifor1_ :: (Bifoldable1 t, Apply f) => t a c -> (a -> f b) -> (c -> f d) -> f ()
- Data.Semigroup.Bifoldable: bisequenceA1_ :: (Bifoldable1 t, Apply f) => t (f a) (f b) -> f ()
- Data.Semigroup.Bifoldable: bitraverse1_ :: (Bifoldable1 t, Apply f) => (a -> f b) -> (c -> f d) -> t a c -> f ()
- Data.Semigroup.Bifoldable: class Bifoldable t => Bifoldable1 t where bifold1 = bifoldMap1 id id bifoldMap1 f g = maybe (error "bifoldMap1") id . getOption . bifoldMap (Option . Just . f) (Option . Just . g)
- Data.Semigroup.Bifoldable: instance Apply f => Semigroup (Act f a)
- Data.Semigroup.Bifoldable: instance Bifoldable1 ((,,) x)
- Data.Semigroup.Bifoldable: instance Bifoldable1 ((,,,) x y)
- Data.Semigroup.Bifoldable: instance Bifoldable1 ((,,,,) x y z)
- Data.Semigroup.Bifoldable: instance Bifoldable1 (,)
- Data.Semigroup.Bifoldable: instance Bifoldable1 Arg
- Data.Semigroup.Bifoldable: instance Bifoldable1 Const
- Data.Semigroup.Bifoldable: instance Bifoldable1 Either
- Data.Semigroup.Bifoldable: instance Bifoldable1 Tagged
- Data.Semigroup.Bifoldable: instance Functor f => Functor (Act f)
- Data.Semigroup.Bitraversable: bifoldMap1Default :: (Bitraversable1 t, Semigroup m) => (a -> m) -> (b -> m) -> t a b -> m
- Data.Semigroup.Bitraversable: bisequence1 :: (Bitraversable1 t, Apply f) => t (f a) (f b) -> f (t a b)
- Data.Semigroup.Bitraversable: bitraverse1 :: (Bitraversable1 t, Apply f) => (a -> f b) -> (c -> f d) -> t a c -> f (t b d)
- Data.Semigroup.Bitraversable: class (Bifoldable1 t, Bitraversable t) => Bitraversable1 t where bitraverse1 f g = bisequence1 . bimap f g bisequence1 = bitraverse1 id id
- Data.Semigroup.Bitraversable: instance Bitraversable1 ((,,) x)
- Data.Semigroup.Bitraversable: instance Bitraversable1 ((,,,) x y)
- Data.Semigroup.Bitraversable: instance Bitraversable1 ((,,,,) x y z)
- Data.Semigroup.Bitraversable: instance Bitraversable1 (,)
- Data.Semigroup.Bitraversable: instance Bitraversable1 Arg
- Data.Semigroup.Bitraversable: instance Bitraversable1 Const
- Data.Semigroup.Bitraversable: instance Bitraversable1 Either
- Data.Semigroup.Bitraversable: instance Bitraversable1 Tagged
+ Data.Biapplicative: instance (Monoid x, Monoid y, Monoid z, Monoid w) => Biapplicative ((,,,,,) x y z w)
+ Data.Biapplicative: instance (Monoid x, Monoid y, Monoid z, Monoid w, Monoid v) => Biapplicative ((,,,,,,) x y z w v)
+ Data.Bifoldable: instance Bifoldable ((,,,,,) x y z w)
+ Data.Bifoldable: instance Bifoldable ((,,,,,,) x y z w v)
+ Data.Bifunctor: instance Bifunctor ((,,,,,) x y z w)
+ Data.Bifunctor: instance Bifunctor ((,,,,,,) x y z w v)
+ Data.Bitraversable: instance Bitraversable ((,,,,,) x y z w)
+ Data.Bitraversable: instance Bitraversable ((,,,,,,) x y z w v)
Files
- .travis.yml +29/−34
- CHANGELOG.markdown +54/−0
- LICENSE +1/−1
- README.markdown +13/−0
- bifunctors.cabal +27/−11
- old-src/Data/Bifunctor.hs +22/−3
- src/Data/Biapplicative.hs +31/−4
- src/Data/Bifoldable.hs +23/−2
- src/Data/Bifunctor/Apply.hs +0/−95
- src/Data/Bifunctor/Biff.hs +1/−20
- src/Data/Bifunctor/Clown.hs +1/−20
- src/Data/Bifunctor/Flip.hs +1/−16
- src/Data/Bifunctor/Join.hs +1/−26
- src/Data/Bifunctor/Joker.hs +1/−28
- src/Data/Bifunctor/Product.hs +2/−15
- src/Data/Bifunctor/Tannen.hs +1/−20
- src/Data/Bifunctor/Wrapped.hs +1/−17
- src/Data/Bitraversable.hs +23/−2
- src/Data/Semigroup/Bifoldable.hs +0/−102
- src/Data/Semigroup/Bitraversable.hs +0/−75
.travis.yml view
@@ -1,50 +1,45 @@-# See https://github.com/hvr/multi-ghc-travis for more information--notifications:- irc:- channels:- - "irc.freenode.org#haskell-lens"- skip_join: true- template:- - "\x0313bifunctors\x03/\x0306%{branch}\x03 \x0314%{commit}\x03 %{build_url} %{message}"- env:- - GHCVER=7.4.1- - GHCVER=7.4.2- - GHCVER=7.6.1- - GHCVER=7.6.2- - GHCVER=7.6.3- - GHCVER=7.8.2- - GHCVER=head+ - GHCVER=7.0.1 CABALVER=1.16+ - GHCVER=7.0.4 CABALVER=1.16+ - GHCVER=7.2.2 CABALVER=1.16+ - 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+ - env: GHCVER=head CABALVER=1.20 before_install:- - sudo add-apt-repository -y ppa:hvr/ghc- - sudo apt-get update- - sudo apt-get install cabal-install-1.18 ghc-$GHCVER- - export PATH=/opt/ghc/$GHCVER/bin:~/.cabal/bin:$PATH+ - 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:- - cabal-1.18 update- - cabal-1.18 install --only-dependencies --enable-tests- - cabal-1.18 install happy packunused packdeps+ - travis_retry cabal update+ - cabal install --enable-tests --only-dependencies script:- - cabal-1.18 configure --enable-tests -v2- - cabal-1.18 build --ghc-options=-ddump-minimal-imports- # - packunused- - packdeps bifunctors.cabal- - cabal-1.18 test- - cabal-1.18 check- - cabal-1.18 sdist- - export SRC_TGZ=$(cabal-1.18 info . | awk '{print $2 ".tar.gz";exit}') ;+ - cabal configure -v2 --enable-tests+ - cabal build+ - cabal sdist+ - export SRC_TGZ=$(cabal info . | awk '{print $2 ".tar.gz";exit}') ; cd dist/; if [ -f "$SRC_TGZ" ]; then- cabal-1.18 install "$SRC_TGZ";+ cabal install "$SRC_TGZ"; else echo "expected '$SRC_TGZ' not found"; exit 1; fi++notifications:+ irc:+ channels:+ - "irc.freenode.org#haskell-lens"+ skip_join: true+ template:+ - "\x0313bifunctors\x0f/\x0306%{branch}\x0f \x0314%{commit}\x0f %{message} \x0302\x1f%{build_url}\x0f"
+ CHANGELOG.markdown view
@@ -0,0 +1,54 @@+5+-+* Inverted the dependency on `semigroupoids`. We can support a much wider array of `base` versions than it can.+* Added flags++4.2.1+-----+* Support `Arg` from `semigroups` 0.16.2+* Fixed a typo.++4.2+---+* Bumped dependency on `tagged`, which is required to build cleanly on GHC 7.9++* Only export `Data.Bifunctor` when building on GHC < 7.9, otherwise it comes from `base`.++4.1.1.1+-------+* Added documentation for 'Bifoldable' and 'Bitraversable'++4.1.1+-----+* Added `Data.Bifunctor.Join`+* Fixed improper lower bounds on `base`++4.1.0.1+-------+* Updated to BSD 2-clause license++4.1+---+* Added product bifunctors++4.0+---+* Compatibility with `semigroupoids` 4.0++3.2+---+* Added missing product instances for `Biapplicative` and `Biapply`.++3.1+-----+* Added `Data.Biapplicative`.+* Added the `Clown` and `Joker` bifunctors from Conor McBride's "Clowns to the left of me, Jokers to the right."+* Added instances for `Const`, higher tuples+* Added `Tagged` instances.++3.0.4+-----+* Added `Data.Bifunctor.Flip` and `Data.Bifunctor.Wrapped`.++3.0.3+---+* Removed upper bounds from my other package dependencies
LICENSE view
@@ -1,4 +1,4 @@-Copyright 2008-2013 Edward Kmett+Copyright 2008-2015 Edward Kmett All rights reserved.
+ README.markdown view
@@ -0,0 +1,13 @@+bifunctors+==========++[](http://travis-ci.org/ekmett/bifunctors)++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
bifunctors.cabal view
@@ -1,6 +1,6 @@ name: bifunctors category: Data, Functors-version: 4.2.1+version: 5 license: BSD3 cabal-version: >= 1.6 license-file: LICENSE@@ -9,32 +9,51 @@ stability: provisional homepage: http://github.com/ekmett/bifunctors/ bug-reports: http://github.com/ekmett/bifunctors/issues-copyright: Copyright (C) 2008-2013 Edward A. Kmett+copyright: Copyright (C) 2008-2015 Edward A. Kmett synopsis: Bifunctors description: Bifunctors build-type: Simple-extra-source-files: .travis.yml+tested-with: GHC == 7.0.1, GHC == 7.0.4, GHC == 7.2.2, GHC == 7.4.2, GHC == 7.6.3, GHC == 7.8.4, GHC == 7.10.1+extra-source-files: .travis.yml CHANGELOG.markdown README.markdown source-repository head type: git location: git://github.com/ekmett/bifunctors.git +flag semigroups+ default: True+ manual: True+ description:+ You can disable the use of the `semigroups` package using `-f-semigroups`.+ .+ Disabing this is an unsupported configuration, but it may be useful for accelerating builds in sandboxes for expert users.++flag tagged+ default: True+ manual: True+ description:+ You can disable the use of the `tagged` package using `-f-tagged`.+ .+ Disabing this is an unsupported configuration, but it may be useful for accelerating builds in sandboxes for expert users.+ library hs-source-dirs: src build-depends:- base >= 4.5 && < 5,- semigroups >= 0.8.3.1 && < 1,- semigroupoids == 4.*,+ base >= 4 && < 5 - tagged >= 0.7.3 && < 1+ if flag(tagged)+ build-depends: tagged >= 0.7.3 && < 1 + if flag(semigroups)+ build-depends: semigroups >= 0.8.3.1 && < 1+ if impl(ghc<7.9) hs-source-dirs: old-src exposed-modules: Data.Bifunctor exposed-modules: Data.Biapplicative- Data.Bifunctor.Apply+ Data.Bifoldable Data.Bifunctor.Biff Data.Bifunctor.Clown Data.Bifunctor.Flip@@ -43,9 +62,6 @@ Data.Bifunctor.Product Data.Bifunctor.Tannen Data.Bifunctor.Wrapped- Data.Bifoldable Data.Bitraversable- Data.Semigroup.Bifoldable- Data.Semigroup.Bitraversable ghc-options: -Wall
old-src/Data/Bifunctor.hs view
@@ -1,8 +1,11 @@ {-# LANGUAGE CPP #-}++#ifndef MIN_VERSION_semigroups+#define MIN_VERSION_semigroups(x,y,z) 0+#endif ----------------------------------------------------------------------------- -- |--- Module : Data.Bifunctor--- Copyright : (C) 2008-2013 Edward Kmett,+-- Copyright : (C) 2008-2015 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com>@@ -15,9 +18,15 @@ ) where import Control.Applicative-import Data.Tagged++#if MIN_VERSION_semigroups(0,16,2) import Data.Semigroup+#endif +#ifdef MIN_VERSION_tagged+import Data.Tagged+#endif+ -- | Minimal definition either 'bimap' or 'first' and 'second' -- | Formally, the class 'Bifunctor' represents a bifunctor@@ -97,6 +106,14 @@ bimap f g ~(x, y, z, a, b) = (x, y, z, f a, g b) {-# INLINE bimap #-} +instance Bifunctor ((,,,,,) x y z w) where+ bimap f g ~(x, y, z, w, a, b) = (x, y, z, w, f a, g b)+ {-# INLINE bimap #-}++instance Bifunctor ((,,,,,,) x y z w v) where+ bimap f g ~(x, y, z, w, v, a, b) = (x, y, z, w, v, f a, g b)+ {-# INLINE bimap #-}+ instance Bifunctor Either where bimap f _ (Left a) = Left (f a) bimap _ g (Right b) = Right (g b)@@ -106,6 +123,8 @@ bimap f _ (Const a) = Const (f a) {-# INLINE bimap #-} +#ifdef MIN_VERSION_tagged instance Bifunctor Tagged where bimap _ g (Tagged b) = Tagged (g b) {-# INLINE bimap #-}+#endif
src/Data/Biapplicative.hs view
@@ -1,8 +1,11 @@ {-# LANGUAGE CPP #-}++#ifndef MIN_VERSION_semigroups+#define MIN_VERSION_semigroups(x,y,z) 0+#endif ----------------------------------------------------------------------------- -- |--- Module : Data.Bifunctor.Apply--- Copyright : (C) 2011-2013 Edward Kmett,+-- Copyright : (C) 2011-2015 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com>@@ -22,11 +25,21 @@ import Control.Applicative import Data.Bifunctor-import Data.Bifunctor.Apply ((<<$>>))++#if MIN_VERSION_semigroups(0,16,2) import Data.Semigroup+#else+import Data.Monoid+#endif++#ifdef MIN_VERSION_tagged import Data.Tagged+#endif -infixl 4 <<*>>, <<*, *>>, <<**>>+infixl 4 <<$>>, <<*>>, <<*, *>>, <<**>>+(<<$>>) :: (a -> b) -> a -> b+(<<$>>) = id+{-# INLINE (<<$>>) #-} class Bifunctor p => Biapplicative p where bipure :: a -> b -> p a b@@ -95,12 +108,26 @@ (x, y, z, f, g) <<*>> (x', y', z', a, b) = (mappend x x', mappend y y', mappend z z', f a, g b) {-# INLINE (<<*>>) #-} +instance (Monoid x, Monoid y, Monoid z, Monoid w) => Biapplicative ((,,,,,) x y z w) where+ bipure = (,,,,,) mempty mempty mempty mempty+ {-# INLINE bipure #-}+ (x, y, z, w, f, g) <<*>> (x', y', z', w', a, b) = (mappend x x', mappend y y', mappend z z', mappend w w', f a, g b)+ {-# INLINE (<<*>>) #-}++instance (Monoid x, Monoid y, Monoid z, Monoid w, Monoid v) => Biapplicative ((,,,,,,) x y z w v) where+ bipure = (,,,,,,) mempty mempty mempty mempty mempty+ {-# INLINE bipure #-}+ (x, y, z, w, v, f, g) <<*>> (x', y', z', w', v', a, b) = (mappend x x', mappend y y', mappend z z', mappend w w', mappend v v', f a, g b)+ {-# INLINE (<<*>>) #-}++#ifdef MIN_VERSION_tagged instance Biapplicative Tagged where bipure _ b = Tagged b {-# INLINE bipure #-} Tagged f <<*>> Tagged x = Tagged (f x) {-# INLINE (<<*>>) #-}+#endif instance Biapplicative Const where bipure a _ = Const a
src/Data/Bifoldable.hs view
@@ -1,8 +1,11 @@ {-# LANGUAGE CPP #-}++#ifndef MIN_VERSION_semigroups+#define MIN_VERSION_semigroups(x,y,z) 0+#endif ----------------------------------------------------------------------------- -- |--- Module : Data.Bifoldable--- Copyright : (C) 2011 Edward Kmett,+-- Copyright : (C) 2011-2015 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com>@@ -30,8 +33,16 @@ ) where import Control.Applicative++#if MIN_VERSION_semigroups(0,16,2) import Data.Semigroup+#else+import Data.Monoid+#endif++#ifdef MIN_VERSION_tagged import Data.Tagged+#endif -- | Minimal definition either 'bifoldr' or 'bifoldMap' @@ -116,9 +127,19 @@ bifoldMap f g ~(_,_,_,a,b) = f a `mappend` g b {-# INLINE bifoldMap #-} +instance Bifoldable ((,,,,,) x y z w) where+ bifoldMap f g ~(_,_,_,_,a,b) = f a `mappend` g b+ {-# INLINE bifoldMap #-}++instance Bifoldable ((,,,,,,) x y z w v) where+ bifoldMap f g ~(_,_,_,_,_,a,b) = f a `mappend` g b+ {-# INLINE bifoldMap #-}++#ifdef MIN_VERSION_tagged instance Bifoldable Tagged where bifoldMap _ g (Tagged b) = g b {-# INLINE bifoldMap #-}+#endif instance Bifoldable Either where bifoldMap f _ (Left a) = f a
− src/Data/Bifunctor/Apply.hs
@@ -1,95 +0,0 @@-{-# LANGUAGE CPP #-}--------------------------------------------------------------------------------- |--- Module : Data.Bifunctor.Apply--- Copyright : (C) 2011-2015 Edward Kmett,--- License : BSD-style (see the file LICENSE)------ Maintainer : Edward Kmett <ekmett@gmail.com>--- Stability : provisional--- Portability : portable---------------------------------------------------------------------------------module Data.Bifunctor.Apply (- -- * Biappliable bifunctors- Biapply(..)- , (<<$>>)- , (<<..>>)- , bilift2- , bilift3- , module Data.Bifunctor- ) where--import Control.Applicative-import Data.Bifunctor-import Data.Semigroup-import Data.Tagged--infixl 4 <<$>>, <<.>>, <<., .>>, <<..>>--(<<$>>) :: (a -> b) -> a -> b-(<<$>>) = id-{-# INLINE (<<$>>) #-}--class Bifunctor p => Biapply p where- (<<.>>) :: p (a -> b) (c -> d) -> p a c -> p b d-- -- |- -- @- -- a '.>' b ≡ 'const' 'id' '<$>' a '<.>' b- -- @- (.>>) :: p a b -> p c d -> p c d- a .>> b = bimap (const id) (const id) <<$>> a <<.>> b- {-# INLINE (.>>) #-}-- -- |- -- @- -- a '<.' b ≡ 'const' '<$>' a '<.>' b- -- @- (<<.) :: p a b -> p c d -> p a b- a <<. b = bimap const const <<$>> a <<.>> b- {-# INLINE (<<.) #-}--(<<..>>) :: Biapply p => p a c -> p (a -> b) (c -> d) -> p b d-(<<..>>) = bilift2 (flip id) (flip id)-{-# INLINE (<<..>>) #-}---- | Lift binary functions-bilift2 :: Biapply w => (a -> b -> c) -> (d -> e -> f) -> w a d -> w b e -> w c f-bilift2 f g a b = bimap f g <<$>> a <<.>> b-{-# INLINE bilift2 #-}---- | Lift ternary functions-bilift3 :: Biapply w => (a -> b -> c -> d) -> (e -> f -> g -> h) -> w a e -> w b f -> w c g -> w d h-bilift3 f g a b c = bimap f g <<$>> a <<.>> b <<.>> c-{-# INLINE bilift3 #-}--instance Biapply (,) where- (f, g) <<.>> (a, b) = (f a, g b)- {-# INLINE (<<.>>) #-}--#if MIN_VERSION_semigroups(0,16,2)-instance Biapply Arg where- Arg f g <<.>> Arg a b = Arg (f a) (g b)- {-# INLINE (<<.>>) #-}-#endif--instance Semigroup x => Biapply ((,,) x) where- (x, f, g) <<.>> (x', a, b) = (x <> x', f a, g b)- {-# INLINE (<<.>>) #-}--instance (Semigroup x, Semigroup y) => Biapply ((,,,) x y) where- (x, y, f, g) <<.>> (x', y', a, b) = (x <> x', y <> y', f a, g b)- {-# INLINE (<<.>>) #-}--instance (Semigroup x, Semigroup y, Semigroup z) => Biapply ((,,,,) x y z) where- (x, y, z, f, g) <<.>> (x', y', z', a, b) = (x <> x', y <> y', z <> z', f a, g b)- {-# INLINE (<<.>>) #-}--instance Biapply Const where- Const f <<.>> Const x = Const (f x)- {-# INLINE (<<.>>) #-}--instance Biapply Tagged where- Tagged f <<.>> Tagged x = Tagged (f x)- {-# INLINE (<<.>>) #-}
src/Data/Bifunctor/Biff.hs view
@@ -1,7 +1,6 @@ ----------------------------------------------------------------------------- -- |--- Module : Data.Bifunctor.Biff--- Copyright : (C) 2008-2013 Edward Kmett,+-- Copyright : (C) 2008-2015 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com>@@ -15,16 +14,10 @@ import Control.Applicative import Data.Biapplicative-import Data.Bifunctor.Apply import Data.Bifoldable import Data.Bitraversable import Data.Foldable-import Data.Functor.Apply import Data.Monoid-import Data.Semigroup.Bifoldable-import Data.Semigroup.Bitraversable-import Data.Semigroup.Foldable-import Data.Semigroup.Traversable import Data.Traversable -- | Compose two 'Functor's on the inside of a 'Bifunctor'.@@ -43,10 +36,6 @@ fmap f = Biff . second (fmap f) . runBiff {-# INLINE fmap #-} -instance (Biapply p, Apply f, Apply g) => Biapply (Biff p f g) where- Biff fg <<.>> Biff xy = Biff (bimap (<.>) (<.>) fg <<.>> xy)- {-# INLINE (<<.>>) #-}- instance (Biapplicative p, Applicative f, Applicative g) => Biapplicative (Biff p f g) where bipure a b = Biff (bipure (pure a) (pure b)) {-# INLINE bipure #-}@@ -69,11 +58,3 @@ instance (Bitraversable p, Traversable f, Traversable g) => Bitraversable (Biff p f g) where bitraverse f g = fmap Biff . bitraverse (traverse f) (traverse g) . runBiff {-# INLINE bitraverse #-}--instance (Bifoldable1 p, Foldable1 f, Foldable1 g) => Bifoldable1 (Biff p f g) where- bifoldMap1 f g = bifoldMap1 (foldMap1 f) (foldMap1 g) . runBiff- {-# INLINE bifoldMap1 #-}--instance (Bitraversable1 p, Traversable1 f, Traversable1 g) => Bitraversable1 (Biff p f g) where- bitraverse1 f g = fmap Biff . bitraverse1 (traverse1 f) (traverse1 g) . runBiff- {-# INLINE bitraverse1 #-}
src/Data/Bifunctor/Clown.hs view
@@ -1,7 +1,6 @@ ----------------------------------------------------------------------------- -- |--- Module : Data.Bifunctor.Clown--- Copyright : (C) 2008-2013 Edward Kmett,+-- Copyright : (C) 2008-2015 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com>@@ -17,16 +16,10 @@ import Control.Applicative import Data.Biapplicative-import Data.Bifunctor.Apply import Data.Bifoldable import Data.Bitraversable import Data.Foldable-import Data.Functor.Apply import Data.Monoid-import Data.Semigroup.Bifoldable-import Data.Semigroup.Bitraversable-import Data.Semigroup.Foldable-import Data.Semigroup.Traversable import Data.Traversable -- | Make a 'Functor' over the first argument of a 'Bifunctor'.@@ -52,10 +45,6 @@ Clown mf <<*>> Clown mx = Clown (mf <*> mx) {-# INLINE (<<*>>) #-} -instance Apply f => Biapply (Clown f) where- Clown fg <<.>> Clown xy = Clown (fg <.> xy)- {-# INLINE (<<.>>) #-}- instance Foldable f => Bifoldable (Clown f) where bifoldMap f _ = foldMap f . runClown {-# INLINE bifoldMap #-}@@ -71,11 +60,3 @@ instance Traversable (Clown f a) where traverse _ = pure . Clown . runClown {-# INLINE traverse #-}--instance Foldable1 f => Bifoldable1 (Clown f) where- bifoldMap1 f _ = foldMap1 f . runClown- {-# INLINE bifoldMap1 #-}--instance Traversable1 f => Bitraversable1 (Clown f) where- bitraverse1 f _ = fmap Clown . traverse1 f . runClown- {-# INLINE bitraverse1 #-}
src/Data/Bifunctor/Flip.hs view
@@ -1,7 +1,7 @@ ----------------------------------------------------------------------------- -- | -- Module : Data.Bifunctor.Flip--- Copyright : (C) 2008-2013 Edward Kmett,+-- Copyright : (C) 2008-2015 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com>@@ -15,13 +15,10 @@ import Control.Applicative import Data.Biapplicative-import Data.Bifunctor.Apply import Data.Bifoldable import Data.Bitraversable import Data.Foldable import Data.Monoid-import Data.Semigroup.Bifoldable-import Data.Semigroup.Bitraversable import Data.Traversable -- | Make a 'Bifunctor' flipping the arguments of a 'Bifunctor'.@@ -47,10 +44,6 @@ Flip fg <<*>> Flip xy = Flip (fg <<*>> xy) {-# INLINE (<<*>>) #-} -instance Biapply p => Biapply (Flip p) where- Flip fg <<.>> Flip xy = Flip (fg <<.>> xy)- {-# INLINE (<<.>>) #-}- instance Bifoldable p => Bifoldable (Flip p) where bifoldMap f g = bifoldMap g f . runFlip {-# INLINE bifoldMap #-}@@ -66,11 +59,3 @@ instance Bitraversable p => Traversable (Flip p a) where traverse f = fmap Flip . bitraverse f pure . runFlip {-# INLINE traverse #-}--instance Bifoldable1 p => Bifoldable1 (Flip p) where- bifoldMap1 f g = bifoldMap1 g f . runFlip- {-# INLINE bifoldMap1 #-}--instance Bitraversable1 p => Bitraversable1 (Flip p) where- bitraverse1 f g = fmap Flip . bitraverse1 g f . runFlip- {-# INLINE bitraverse1 #-}
src/Data/Bifunctor/Join.hs view
@@ -1,8 +1,7 @@ {-# LANGUAGE StandaloneDeriving, FlexibleContexts, UndecidableInstances #-} ----------------------------------------------------------------------------- -- |--- Module : Data.Bifunctor.Join--- Copyright : (C) 2008-2013 Edward Kmett,+-- Copyright : (C) 2008-2015 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com>@@ -17,14 +16,8 @@ import Control.Applicative import Data.Biapplicative import Data.Bifoldable-import Data.Bifunctor.Apply import Data.Bitraversable import Data.Foldable-import Data.Functor.Bind-import Data.Semigroup.Bifoldable-import Data.Semigroup.Bitraversable-import Data.Semigroup.Foldable-import Data.Semigroup.Traversable import Data.Traversable -- | Make a 'Functor' over both arguments of a 'Bifunctor'.@@ -49,14 +42,6 @@ Join a <* Join b = Join (a <<* b) {-# INLINE (<*) #-} -instance Biapply p => Apply (Join p) where- Join f <.> Join a = Join (f <<.>> a)- {-# INLINE (<.>) #-}- Join a .> Join b = Join (a .>> b)- {-# INLINE (.>) #-}- Join a <. Join b = Join (a <<. b)- {-# INLINE (<.) #-}- instance Bifoldable p => Foldable (Join p) where foldMap f (Join a) = bifoldMap f f a {-# INLINE foldMap #-}@@ -66,13 +51,3 @@ {-# INLINE traverse #-} sequenceA (Join a) = fmap Join (bisequenceA a) {-# INLINE sequenceA #-}--instance Bifoldable1 p => Foldable1 (Join p) where- foldMap1 f (Join a) = bifoldMap1 f f a- {-# INLINE foldMap1 #-}--instance Bitraversable1 p => Traversable1 (Join p) where- traverse1 f (Join a) = fmap Join (bitraverse1 f f a)- {-# INLINE traverse1 #-}- sequence1 (Join a) = fmap Join (bisequence1 a)- {-# INLINE sequence1 #-}
src/Data/Bifunctor/Joker.hs view
@@ -1,7 +1,6 @@ ----------------------------------------------------------------------------- -- |--- Module : Data.Bifunctor.Joker--- Copyright : (C) 2008-2013 Edward Kmett,+-- Copyright : (C) 2008-2015 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com>@@ -17,15 +16,9 @@ import Control.Applicative import Data.Biapplicative-import Data.Bifunctor.Apply import Data.Bifoldable import Data.Bitraversable import Data.Foldable-import Data.Functor.Apply-import Data.Semigroup.Bifoldable-import Data.Semigroup.Bitraversable-import Data.Semigroup.Foldable-import Data.Semigroup.Traversable import Data.Traversable -- | Make a 'Functor' over the second argument of a 'Bifunctor'.@@ -51,10 +44,6 @@ Joker mf <<*>> Joker mx = Joker (mf <*> mx) {-# INLINE (<<*>>) #-} -instance Apply g => Biapply (Joker g) where- Joker fg <<.>> Joker xy = Joker (fg <.> xy)- {-# INLINE (<<.>>) #-}- instance Foldable g => Bifoldable (Joker g) where bifoldMap _ g = foldMap g . runJoker {-# INLINE bifoldMap #-}@@ -70,19 +59,3 @@ instance Traversable g => Traversable (Joker g a) where traverse g = fmap Joker . traverse g . runJoker {-# INLINE traverse #-}--instance Foldable1 g => Bifoldable1 (Joker g) where- bifoldMap1 _ g = foldMap1 g . runJoker- {-# INLINE bifoldMap1 #-}--instance Foldable1 g => Foldable1 (Joker g a) where- foldMap1 g = foldMap1 g . runJoker- {-# INLINE foldMap1 #-}--instance Traversable1 g => Bitraversable1 (Joker g) where- bitraverse1 _ g = fmap Joker . traverse1 g . runJoker- {-# INLINE bitraverse1 #-}--instance Traversable1 g => Traversable1 (Joker g a) where- traverse1 g = fmap Joker . traverse1 g . runJoker- {-# INLINE traverse1 #-}
src/Data/Bifunctor/Product.hs view
@@ -1,7 +1,6 @@ ----------------------------------------------------------------------------- -- |--- Module : Data.Bifunctor.Product--- Copyright : (C) 2008-2013 Jesse Selover,+-- Copyright : (C) 2008-2015 Jesse Selover, Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com>@@ -16,13 +15,9 @@ import Control.Applicative import Data.Biapplicative-import Data.Functor.Apply import Data.Bifoldable import Data.Bitraversable-import Data.Monoid hiding (Product, (<>))-import Data.Semigroup hiding (Product)-import Data.Semigroup.Bifoldable-import Data.Semigroup.Bitraversable+import Data.Monoid hiding (Product) -- | Form the product of two bifunctors data Product f g a b = Pair (f a b) (g a b) deriving (Eq,Ord,Show,Read)@@ -48,11 +43,3 @@ instance (Bitraversable f, Bitraversable g) => Bitraversable (Product f g) where bitraverse f g (Pair x y) = Pair <$> bitraverse f g x <*> bitraverse f g y {-# INLINE bitraverse #-}--instance (Bifoldable1 f, Bifoldable1 g) => Bifoldable1 (Product f g) where- bifoldMap1 f g (Pair x y) = bifoldMap1 f g x <> bifoldMap1 f g y- {-# INLINE bifoldMap1 #-}--instance (Bitraversable1 f, Bitraversable1 g) => Bitraversable1 (Product f g) where- bitraverse1 f g (Pair x y) = Pair <$> bitraverse1 f g x <.> bitraverse1 f g y- {-# INLINE bitraverse1 #-}
src/Data/Bifunctor/Tannen.hs view
@@ -1,7 +1,6 @@ ----------------------------------------------------------------------------- -- |--- Module : Data.Bifunctor.Tannen--- Copyright : (C) 2008-2013 Edward Kmett,+-- Copyright : (C) 2008-2015 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com>@@ -15,16 +14,10 @@ import Control.Applicative import Data.Biapplicative-import Data.Bifunctor.Apply import Data.Bifoldable import Data.Bitraversable import Data.Foldable-import Data.Functor.Apply import Data.Monoid-import Data.Semigroup.Bifoldable-import Data.Semigroup.Bitraversable-import Data.Semigroup.Foldable-import Data.Semigroup.Traversable import Data.Traversable -- | Compose a 'Functor' on the outside of a 'Bifunctor'.@@ -43,10 +36,6 @@ fmap f = Tannen . fmap (second f) . runTannen {-# INLINE fmap #-} -instance (Apply f, Biapply p) => Biapply (Tannen f p) where- Tannen fg <<.>> Tannen xy = Tannen ((<<.>>) <$> fg <.> xy)- {-# INLINE (<<.>>) #-}- instance (Applicative f, Biapplicative p) => Biapplicative (Tannen f p) where bipure a b = Tannen (pure (bipure a b)) {-# INLINE bipure #-}@@ -69,11 +58,3 @@ instance (Traversable f, Bitraversable p) => Bitraversable (Tannen f p) where bitraverse f g = fmap Tannen . traverse (bitraverse f g) . runTannen {-# INLINE bitraverse #-}--instance (Foldable1 f, Bifoldable1 p) => Bifoldable1 (Tannen f p) where- bifoldMap1 f g = foldMap1 (bifoldMap1 f g) . runTannen- {-# INLINE bifoldMap1 #-}--instance (Traversable1 f, Bitraversable1 p) => Bitraversable1 (Tannen f p) where- bitraverse1 f g = fmap Tannen . traverse1 (bitraverse1 f g) . runTannen- {-# INLINE bitraverse1 #-}
src/Data/Bifunctor/Wrapped.hs view
@@ -1,7 +1,6 @@ ----------------------------------------------------------------------------- -- |--- Module : Data.Bifunctor--- Copyright : (C) 2008-2013 Edward Kmett,+-- Copyright : (C) 2008-2015 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com>@@ -16,12 +15,9 @@ import Control.Applicative import Data.Biapplicative import Data.Bifoldable-import Data.Bifunctor.Apply import Data.Bitraversable import Data.Foldable import Data.Monoid-import Data.Semigroup.Bifoldable-import Data.Semigroup.Bitraversable import Data.Traversable -- | Make a 'Functor' over the second argument of a 'Bifunctor'.@@ -40,10 +36,6 @@ fmap f = WrapBifunctor . second f . unwrapBifunctor {-# INLINE fmap #-} -instance Biapply p => Biapply (WrappedBifunctor p) where- WrapBifunctor fg <<.>> WrapBifunctor xy = WrapBifunctor (fg <<.>> xy)- {-# INLINE (<<.>>) #-}- instance Biapplicative p => Biapplicative (WrappedBifunctor p) where bipure a b = WrapBifunctor (bipure a b) {-# INLINE bipure #-}@@ -65,11 +57,3 @@ instance Bitraversable p => Bitraversable (WrappedBifunctor p) where bitraverse f g = fmap WrapBifunctor . bitraverse f g . unwrapBifunctor {-# INLINE bitraverse #-}--instance Bifoldable1 p => Bifoldable1 (WrappedBifunctor p) where- bifoldMap1 f g = bifoldMap1 f g . unwrapBifunctor- {-# INLINE bifoldMap1 #-}--instance Bitraversable1 p => Bitraversable1 (WrappedBifunctor p) where- bitraverse1 f g = fmap WrapBifunctor . bitraverse1 f g . unwrapBifunctor- {-# INLINE bitraverse1 #-}
src/Data/Bitraversable.hs view
@@ -1,8 +1,11 @@ {-# LANGUAGE CPP #-}++#ifndef MIN_VERSION_semigroups+#define MIN_VERSION_semigroups(x,y,z) 0+#endif ----------------------------------------------------------------------------- -- |--- Module : Data.Bitraversable--- Copyright : (C) 2011 Edward Kmett,+-- Copyright : (C) 2011 Edward Kmett -- License : BSD-style (see the file LICENSE) -- -- Maintainer : Edward Kmett <ekmett@gmail.com>@@ -23,8 +26,16 @@ import Control.Applicative import Data.Bifunctor import Data.Bifoldable++#if MIN_VERSION_semigroups(0,16,2) import Data.Semigroup+#else+import Data.Monoid+#endif++#ifdef MIN_VERSION_tagged import Data.Tagged+#endif -- | Minimal complete definition either 'bitraverse' or 'bisequenceA'. @@ -172,6 +183,14 @@ bitraverse f g ~(x, y, z, a, b) = (,,,,) x y z <$> f a <*> g b {-# INLINE bitraverse #-} +instance Bitraversable ((,,,,,) x y z w) where+ bitraverse f g ~(x, y, z, w, a, b) = (,,,,,) x y z w <$> f a <*> g b+ {-# INLINE bitraverse #-}++instance Bitraversable ((,,,,,,) x y z w v) where+ bitraverse f g ~(x, y, z, w, v, a, b) = (,,,,,,) x y z w v <$> f a <*> g b+ {-# INLINE bitraverse #-}+ instance Bitraversable Either where bitraverse f _ (Left a) = Left <$> f a bitraverse _ g (Right b) = Right <$> g b@@ -181,9 +200,11 @@ bitraverse f _ (Const a) = Const <$> f a {-# INLINE bitraverse #-} +#ifdef MIN_VERSION_tagged instance Bitraversable Tagged where bitraverse _ g (Tagged b) = Tagged <$> g b {-# INLINE bitraverse #-}+#endif -- | 'bifor' is 'bitraverse' with the structure as the first argument. bifor :: (Bitraversable t, Applicative f) => t a b -> (a -> f c) -> (b -> f d) -> f (t c d)
− src/Data/Semigroup/Bifoldable.hs
@@ -1,102 +0,0 @@-{-# LANGUAGE CPP #-}--------------------------------------------------------------------------------- |--- Module : Data.Semigroup.Foldable--- Copyright : (C) 2011-2015 Edward Kmett--- License : BSD-style (see the file LICENSE)------ Maintainer : Edward Kmett <ekmett@gmail.com>--- Stability : provisional--- Portability : portable---------------------------------------------------------------------------------module Data.Semigroup.Bifoldable- ( Bifoldable1(..)- , bitraverse1_- , bifor1_- , bisequenceA1_- , bifoldMapDefault1- ) where--import Control.Applicative-import Data.Bifoldable-import Data.Functor.Apply-import Data.Semigroup-import Data.Tagged-import Prelude hiding (foldr)--class Bifoldable t => Bifoldable1 t where- bifold1 :: Semigroup m => t m m -> m- bifold1 = bifoldMap1 id id- {-# INLINE bifold1 #-}-- bifoldMap1 :: Semigroup m => (a -> m) -> (b -> m) -> t a b -> m- bifoldMap1 f g = maybe (error "bifoldMap1") id . getOption . bifoldMap (Option . Just . f) (Option . Just . g)- {-# INLINE bifoldMap1 #-}--#if MIN_VERSION_semigroups(0,16,2)-instance Bifoldable1 Arg where- bifoldMap1 f g (Arg a b) = f a <> g b-#endif--instance Bifoldable1 Either where- bifoldMap1 f _ (Left a) = f a- bifoldMap1 _ g (Right b) = g b- {-# INLINE bifoldMap1 #-}--instance Bifoldable1 (,) where- bifoldMap1 f g (a, b) = f a <> g b- {-# INLINE bifoldMap1 #-}--instance Bifoldable1 ((,,) x) where- bifoldMap1 f g (_,a,b) = f a <> g b- {-# INLINE bifoldMap1 #-}--instance Bifoldable1 ((,,,) x y) where- bifoldMap1 f g (_,_,a,b) = f a <> g b- {-# INLINE bifoldMap1 #-}--instance Bifoldable1 ((,,,,) x y z) where- bifoldMap1 f g (_,_,_,a,b) = f a <> g b- {-# INLINE bifoldMap1 #-}--instance Bifoldable1 Const where- bifoldMap1 f _ (Const a) = f a- {-# INLINE bifoldMap1 #-}--instance Bifoldable1 Tagged where- bifoldMap1 _ g (Tagged b) = g b- {-# INLINE bifoldMap1 #-}--newtype Act f a = Act { getAct :: f a }--instance Apply f => Semigroup (Act f a) where- Act a <> Act b = Act (a .> b)- {-# INLINE (<>) #-}--instance Functor f => Functor (Act f) where- fmap f (Act a) = Act (f <$> a)- {-# INLINE fmap #-}- b <$ Act a = Act (b <$ a)- {-# INLINE (<$) #-}--bitraverse1_ :: (Bifoldable1 t, Apply f) => (a -> f b) -> (c -> f d) -> t a c -> f ()-bitraverse1_ f g t = getAct (bifoldMap1 (Act . ignore . f) (Act . ignore . g) t)-{-# INLINE bitraverse1_ #-}--bifor1_ :: (Bifoldable1 t, Apply f) => t a c -> (a -> f b) -> (c -> f d) -> f ()-bifor1_ t f g = bitraverse1_ f g t-{-# INLINE bifor1_ #-}--ignore :: Functor f => f a -> f ()-ignore = (() <$)-{-# INLINE ignore #-}--bisequenceA1_ :: (Bifoldable1 t, Apply f) => t (f a) (f b) -> f ()-bisequenceA1_ t = getAct (bifoldMap1 (Act . ignore) (Act . ignore) t)-{-# INLINE bisequenceA1_ #-}---- | Usable default for foldMap, but only if you define bifoldMap1 yourself-bifoldMapDefault1 :: (Bifoldable1 t, Monoid m) => (a -> m) -> (b -> m) -> t a b -> m-bifoldMapDefault1 f g = unwrapMonoid . bifoldMap (WrapMonoid . f) (WrapMonoid . g)-{-# INLINE bifoldMapDefault1 #-}
− src/Data/Semigroup/Bitraversable.hs
@@ -1,75 +0,0 @@-{-# LANGUAGE CPP #-}--------------------------------------------------------------------------------- |--- Module : Data.Semigroup.Bitraversable--- Copyright : (C) 2011-2015 Edward Kmett--- License : BSD-style (see the file LICENSE)------ Maintainer : Edward Kmett <ekmett@gmail.com>--- Stability : provisional--- Portability : portable---------------------------------------------------------------------------------module Data.Semigroup.Bitraversable- ( Bitraversable1(..)- , bifoldMap1Default- ) where--import Control.Applicative-import Data.Bitraversable-import Data.Bifunctor-import Data.Functor.Apply-import Data.Semigroup-import Data.Semigroup.Bifoldable-import Data.Tagged--class (Bifoldable1 t, Bitraversable t) => Bitraversable1 t where- bitraverse1 :: Apply f => (a -> f b) -> (c -> f d) -> t a c -> f (t b d)- bitraverse1 f g = bisequence1 . bimap f g- {-# INLINE bitraverse1 #-}-- bisequence1 :: Apply f => t (f a) (f b) -> f (t a b)- bisequence1 = bitraverse1 id id- {-# INLINE bisequence1 #-}--#if defined(__GLASGOW_HASKELL__) && __GLASGOW_HASKELL__ >= 708- {-# MINIMAL bitraverse1 | bisequence1 #-}-#endif--#if MIN_VERSION_semigroups(0,16,2)-instance Bitraversable1 Arg where- bitraverse1 f g (Arg a b) = Arg <$> f a <.> g b-#endif--bifoldMap1Default :: (Bitraversable1 t, Semigroup m) => (a -> m) -> (b -> m) -> t a b -> m-bifoldMap1Default f g = getConst . bitraverse1 (Const . f) (Const . g)-{-# INLINE bifoldMap1Default #-}--instance Bitraversable1 Either where- bitraverse1 f _ (Left a) = Left <$> f a- bitraverse1 _ g (Right b) = Right <$> g b- {-# INLINE bitraverse1 #-}--instance Bitraversable1 (,) where- bitraverse1 f g (a, b) = (,) <$> f a <.> g b- {-# INLINE bitraverse1 #-}--instance Bitraversable1 ((,,) x) where- bitraverse1 f g (x, a, b) = (,,) x <$> f a <.> g b- {-# INLINE bitraverse1 #-}--instance Bitraversable1 ((,,,) x y) where- bitraverse1 f g (x, y, a, b) = (,,,) x y <$> f a <.> g b- {-# INLINE bitraverse1 #-}--instance Bitraversable1 ((,,,,) x y z) where- bitraverse1 f g (x, y, z, a, b) = (,,,,) x y z <$> f a <.> g b- {-# INLINE bitraverse1 #-}--instance Bitraversable1 Const where- bitraverse1 f _ (Const a) = Const <$> f a- {-# INLINE bitraverse1 #-}--instance Bitraversable1 Tagged where- bitraverse1 _ g (Tagged b) = Tagged <$> g b- {-# INLINE bitraverse1 #-}