diff options
author | Andrew Martin <andrew.thaddeus@gmail.com> | 2018-04-25 19:35:36 -0400 |
---|---|---|
committer | Ben Gamari <ben@smart-cactus.org> | 2018-05-03 12:00:51 -0400 |
commit | e34e30e492a7bc40e3da5a05b8e297acb0aeeadc (patch) | |
tree | 8a7acac21a7ab542ec747669d653b1cb92d779ea /libraries | |
parent | 358b508051333882d4099acca8f269e6fb2b7d65 (diff) | |
download | haskell-e34e30e492a7bc40e3da5a05b8e297acb0aeeadc.tar.gz |
Warn against using Data.Monoid.First
Noting that it will be removed in the future.
Diffstat (limited to 'libraries')
-rw-r--r-- | libraries/base/Data/Monoid.hs | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/libraries/base/Data/Monoid.hs b/libraries/base/Data/Monoid.hs index b6d09c1f2d..d11eda8a00 100644 --- a/libraries/base/Data/Monoid.hs +++ b/libraries/base/Data/Monoid.hs @@ -88,6 +88,16 @@ import Data.Semigroup.Internal -- -- >>> getFirst (First (Just "hello") <> First Nothing <> First (Just "world")) -- Just "hello" +-- +-- Use of this type is discouraged. Note the following equivalence: +-- +-- > Data.Monoid.First x === Maybe (Data.Semigroup.First 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. It will be 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 } deriving ( Eq -- ^ @since 2.01 , Ord -- ^ @since 2.01 |