1{-# LANGUAGE CPP #-}
2#if __GLASGOW_HASKELL__ >= 704
3{-# LANGUAGE Safe #-}
4#elif __GLASGOW_HASKELL__ >= 702
5{-# LANGUAGE Trustworthy #-}
6#endif
7-----------------------------------------------------------------------------
8-- |
9-- Copyright   :  (C) 2011-2015 Edward Kmett
10-- License     :  BSD-style (see the file LICENSE)
11--
12-- Maintainer  :  Edward Kmett <ekmett@gmail.com>
13-- Stability   :  provisional
14-- Portability :  portable
15--
16----------------------------------------------------------------------------
17module Data.Semigroup.Traversable
18  ( Traversable1(..)
19  , foldMap1Default
20  ) where
21
22import Control.Applicative
23#if !(MIN_VERSION_base(4,11,0))
24import Data.Semigroup
25#endif
26import Data.Semigroup.Traversable.Class
27
28foldMap1Default :: (Traversable1 f, Semigroup m) => (a -> m) -> f a -> m
29foldMap1Default f = getConst . traverse1 (Const . f)
30