diff options
author | Herbert Valerio Riedel <hvr@gnu.org> | 2014-09-27 22:55:19 +0200 |
---|---|---|
committer | Herbert Valerio Riedel <hvr@gnu.org> | 2014-09-27 23:06:35 +0200 |
commit | f636faa7b2b7fc1d0663f994ad08f365d39a746d (patch) | |
tree | 5dc27302af7583ba10c197636860b56c1f68bd80 /libraries/base | |
parent | 51aa2fa3e65a960c1432dba9acc29db719964618 (diff) | |
download | haskell-f636faa7b2b7fc1d0663f994ad08f365d39a746d.tar.gz |
Set default-impl of `mapM`/`sequence` methods to `traverse`/`sequenceA`
This is made possible by the AMP, as we don't need the `WrappedMonad`
helper for that anymore.
Approved-by: Edward Kmett <ekmett@gmail.com>
Diffstat (limited to 'libraries/base')
-rw-r--r-- | libraries/base/Data/Traversable.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/libraries/base/Data/Traversable.hs b/libraries/base/Data/Traversable.hs index eb5123dde6..1c8b605f09 100644 --- a/libraries/base/Data/Traversable.hs +++ b/libraries/base/Data/Traversable.hs @@ -46,7 +46,7 @@ module Data.Traversable ( foldMapDefault, ) where -import Control.Applicative ( Const(..), WrappedMonad(..) ) +import Control.Applicative ( Const(..) ) import Data.Either ( Either(..) ) import Data.Foldable ( Foldable ) import Data.Functor @@ -157,12 +157,12 @@ class (Functor t, Foldable t) => Traversable t where -- | Map each element of a structure to a monadic action, evaluate -- these actions from left to right, and collect the results. mapM :: Monad m => (a -> m b) -> t a -> m (t b) - mapM f = unwrapMonad . traverse (WrapMonad . f) + mapM = traverse -- | Evaluate each monadic action in the structure from left to right, -- and collect the results. sequence :: Monad m => t (m a) -> m (t a) - sequence = mapM id + sequence = sequenceA {-# MINIMAL traverse | sequenceA #-} -- instances for Prelude types |