{-# LANGUAGE CPP #-}
#if __GLASGOW_HASKELL__ >= 704
{-# LANGUAGE Safe #-}
#elif __GLASGOW_HASKELL__ >= 702
{-# LANGUAGE Trustworthy #-}
#endif
module Data.Semigroup.Traversable
( Traversable1(..)
, foldMap1Default
) where
import Control.Applicative
#if !(MIN_VERSION_base(4,11,0))
import Data.Semigroup
#endif
import Data.Semigroup.Traversable.Class
foldMap1Default :: (Traversable1 f, Semigroup m) => (a -> m) -> f a -> m
foldMap1Default :: (a -> m) -> f a -> m
foldMap1Default a -> m
f = Const m (f Any) -> m
forall a k (b :: k). Const a b -> a
getConst (Const m (f Any) -> m) -> (f a -> Const m (f Any)) -> f a -> m
forall b c a. (b -> c) -> (a -> b) -> a -> c
. (a -> Const m Any) -> f a -> Const m (f Any)
forall (t :: * -> *) (f :: * -> *) a b.
(Traversable1 t, Apply f) =>
(a -> f b) -> t a -> f (t b)
traverse1 (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)