summaryrefslogtreecommitdiff
path: root/libraries/base
diff options
context:
space:
mode:
authorHerbert Valerio Riedel <hvr@gnu.org>2014-09-27 22:55:19 +0200
committerHerbert Valerio Riedel <hvr@gnu.org>2014-09-27 23:06:35 +0200
commitf636faa7b2b7fc1d0663f994ad08f365d39a746d (patch)
tree5dc27302af7583ba10c197636860b56c1f68bd80 /libraries/base
parent51aa2fa3e65a960c1432dba9acc29db719964618 (diff)
downloadhaskell-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.hs6
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