diff options
author | Paavo <pparkkin@gmail.com> | 2020-03-17 20:10:32 +0200 |
---|---|---|
committer | Marge Bot <ben+marge-bot@smart-cactus.org> | 2020-03-24 08:31:32 -0400 |
commit | 2643ba465cd2a133b6f495f34fc59cd1a6d23525 (patch) | |
tree | 7e8393757a1408d6bd91ed7f4be7913ac5622f76 | |
parent | 19f125578247dfe8036b5793cb3f6b684474f9c7 (diff) | |
download | haskell-2643ba465cd2a133b6f495f34fc59cd1a6d23525.tar.gz |
Add example and doc for Arg (Fixes #17153)
-rw-r--r-- | libraries/base/Data/Semigroup.hs | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/libraries/base/Data/Semigroup.hs b/libraries/base/Data/Semigroup.hs index bde40fa57a..3b123ad81e 100644 --- a/libraries/base/Data/Semigroup.hs +++ b/libraries/base/Data/Semigroup.hs @@ -286,7 +286,15 @@ instance Num a => Num (Max a) where -- | 'Arg' isn't itself a 'Semigroup' in its own right, but it can be -- placed inside 'Min' and 'Max' to compute an arg min or arg max. -data Arg a b = Arg a b deriving +-- +-- >>> minimum [ Arg (x * x) x | x <- [-10 .. 10] ] +-- Arg 0 0 +data Arg a b = Arg + a + -- ^ The argument used for comparisons in 'Eq' and 'Ord'. + b + -- ^ The "value" exposed via the 'Functor', 'Foldable' etc. instances. + deriving ( Show -- ^ @since 4.9.0.0 , Read -- ^ @since 4.9.0.0 , Data -- ^ @since 4.9.0.0 |