diff options
author | GinBaby <jdog74@gmail.com> | 2017-03-06 13:43:57 -0500 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2017-03-06 17:23:01 -0500 |
commit | f57bd2ae8fc787f14aeafa3f2f7ded253456528c (patch) | |
tree | b3c16e177c4d3a733544fd431cc549bfd482685a | |
parent | 3fdabe9873e311571f614d455d1b16bc3f4fdc0f (diff) | |
download | haskell-f57bd2ae8fc787f14aeafa3f2f7ded253456528c.tar.gz |
add example documentation for tuple Applicative
Reviewers: austin, hvr, bgamari, dfeuer
Reviewed By: dfeuer
Subscribers: dfeuer, thomie
Differential Revision: https://phabricator.haskell.org/D3284
-rw-r--r-- | libraries/base/Control/Applicative.hs | 2 | ||||
-rw-r--r-- | libraries/base/GHC/Base.hs | 9 |
2 files changed, 9 insertions, 2 deletions
diff --git a/libraries/base/Control/Applicative.hs b/libraries/base/Control/Applicative.hs index 8883818280..406f086e94 100644 --- a/libraries/base/Control/Applicative.hs +++ b/libraries/base/Control/Applicative.hs @@ -106,7 +106,7 @@ instance (ArrowZero a, ArrowPlus a) => Alternative (WrappedArrow a b) where newtype ZipList a = ZipList { getZipList :: [a] } deriving ( Show, Eq, Ord, Read, Functor , Foldable, Generic, Generic1) --- See Data.Traversable for Traversabel instance due to import loops +-- See Data.Traversable for Traversable instance due to import loops -- | @since 2.01 instance Applicative ZipList where diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs index e07c077e84..2f155c6bce 100644 --- a/libraries/base/GHC/Base.hs +++ b/libraries/base/GHC/Base.hs @@ -327,7 +327,14 @@ instance Monoid a => Monoid (Maybe a) where m `mappend` Nothing = m Just m1 `mappend` Just m2 = Just (m1 `mappend` m2) --- | @since 2.01 +-- | For tuples, the 'Monoid' constraint on @a@ determines +-- how the first values merge. +-- For example, 'String's concatenate: +-- +-- > ("hello ", (+15)) <*> ("world!", 2002) +-- > ("hello world!",2017) +-- +-- @since 2.01 instance Monoid a => Applicative ((,) a) where pure x = (mempty, x) (u, f) <*> (v, x) = (u `mappend` v, f x) |