summaryrefslogtreecommitdiff
path: root/libraries/base
diff options
context:
space:
mode:
authorAndrew Martin <andrew.thaddeus@gmail.com>2018-04-25 21:01:25 -0400
committerBen Gamari <ben@smart-cactus.org>2018-05-03 12:00:56 -0400
commitcf35ab9ac7e0f33e39af6af16ecf850e24c2cb79 (patch)
treedf36c439c7ab30d1c7c1cc343b6748611afe3e32 /libraries/base
parent90589a942b770b9c373a73b6c1d17487fdcf4d9b (diff)
downloadhaskell-cf35ab9ac7e0f33e39af6af16ecf850e24c2cb79.tar.gz
minor improvement to wording of warning against First. Add warning against Last
Diffstat (limited to 'libraries/base')
-rw-r--r--libraries/base/Data/Monoid.hs12
1 files changed, 11 insertions, 1 deletions
diff --git a/libraries/base/Data/Monoid.hs b/libraries/base/Data/Monoid.hs
index d11eda8a00..aa3000ad3b 100644
--- a/libraries/base/Data/Monoid.hs
+++ b/libraries/base/Data/Monoid.hs
@@ -95,7 +95,7 @@ import Data.Semigroup.Internal
--
-- In additional to being equivalent in the structural sense, the two
-- also have 'Monoid' instances that behave the same. This type will
--- be marked deprecated in GHC 8.8. It will be removed in GHC 8.10.
+-- be marked deprecated in GHC 8.8, and removed in GHC 8.10.
-- Users are advised to use the variant from "Data.Semigroup" and wrap
-- it in 'Maybe'.
newtype First a = First { getFirst :: Maybe a }
@@ -127,6 +127,16 @@ instance Monoid (First a) where
--
-- >>> getLast (Last (Just "hello") <> Last Nothing <> Last (Just "world"))
-- Just "world"
+--
+-- Use of this type is discouraged. Note the following equivalence:
+--
+-- > Data.Monoid.Last x === Maybe (Data.Semigroup.Last x)
+--
+-- In additional to being equivalent in the structural sense, the two
+-- also have 'Monoid' instances that behave the same. This type will
+-- be marked deprecated in GHC 8.8, and removed in GHC 8.10.
+-- Users are advised to use the variant from "Data.Semigroup" and wrap
+-- it in 'Maybe'.
newtype Last a = Last { getLast :: Maybe a }
deriving ( Eq -- ^ @since 2.01
, Ord -- ^ @since 2.01