diff options
author | Ben Gamari <ben@smart-cactus.org> | 2015-08-07 05:50:22 +0200 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2015-08-07 06:41:10 +0200 |
commit | a1c934c1b97a09db841d20da4811e0e1310f7511 (patch) | |
tree | 309e4d3f7bff929fe0e11babfa551ff6aceda573 /libraries/base/Data/Traversable.hs | |
parent | bc43d23aa8a63ce64c2eeb5a2c74fb58c8f21356 (diff) | |
download | haskell-a1c934c1b97a09db841d20da4811e0e1310f7511.tar.gz |
base: Add missing Traversable instance for ZipList
Diffstat (limited to 'libraries/base/Data/Traversable.hs')
-rw-r--r-- | libraries/base/Data/Traversable.hs | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/libraries/base/Data/Traversable.hs b/libraries/base/Data/Traversable.hs index 535db00125..81e639cf37 100644 --- a/libraries/base/Data/Traversable.hs +++ b/libraries/base/Data/Traversable.hs @@ -46,7 +46,9 @@ module Data.Traversable ( foldMapDefault, ) where -import Control.Applicative ( Const(..) ) +-- It is convenient to use 'Const' here but this means we must +-- define a few instances here which really belong in Control.Applicative +import Control.Applicative ( Const(..), ZipList(..) ) import Data.Either ( Either(..) ) import Data.Foldable ( Foldable ) import Data.Functor @@ -217,6 +219,9 @@ instance Traversable First where instance Traversable Last where traverse f (Last x) = Last <$> traverse f x +instance Traversable ZipList where + traverse f (ZipList x) = ZipList <$> traverse f x + -- general functions -- | 'for' is 'traverse' with its arguments flipped. For a version |