{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 704
{-# LANGUAGE Safe #-}
#elif __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Trustworthy #-}
#endif
module Data.Semigroup.Bitraversable
( Bitraversable1(..)
, bifoldMap1Default
) where
import Control.Applicative
#if !(MIN_VERSION_base(4,11,0))
import Data.Semigroup
#endif
import Data.Semigroup.Traversable.Class
bifoldMap1Default :: (Bitraversable1 t, Semigroup m) => (a -> m) -> (b -> m) -> t a b -> m
bifoldMap1Default :: (a -> m) -> (b -> m) -> t a b -> m
bifoldMap1Default a -> m
f b -> m
g = Const m (t Any Any) -> m
forall a k (b :: k). Const a b -> a
getConst (Const m (t Any Any) -> m)
-> (t a b -> Const m (t Any Any)) -> t a b -> m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> Const m Any)
-> (b -> Const m Any) -> t a b -> Const m (t Any Any)
forall (t :: * -> * -> *) (f :: * -> *) a b c d.
(Bitraversable1 t, Apply f) =>
(a -> f b) -> (c -> f d) -> t a c -> f (t b d)
bitraverse1 (m -> Const m Any
forall k a (b :: k). a -> Const a b
Const (m -> Const m Any) -> (a -> m) -> a -> Const m Any
forall b c a. (b -> c) -> (a -> b) -> a -> c
. a -> m
f) (m -> Const m Any
forall k a (b :: k). a -> Const a b
Const (m -> Const m Any) -> (b -> m) -> b -> Const m Any
forall b c a. (b -> c) -> (a -> b) -> a -> c
. b -> m
g)
{-# INLINE bifoldMap1Default #-}