[Git][ghc/ghc][master] Add example and doc for Arg (Fixes #17153)

Marge Bot gitlab at gitlab.haskell.org
Tue Mar 24 12:31:41 UTC 2020



 Marge Bot pushed to branch master at Glasgow Haskell Compiler / GHC


Commits:
2643ba46 by Paavo at 2020-03-24T08:31:32-04:00
Add example and doc for Arg (Fixes #17153)

- - - - -


1 changed file:

- libraries/base/Data/Semigroup.hs


Changes:

=====================================
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



View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2643ba465cd2a133b6f495f34fc59cd1a6d23525

-- 
View it on GitLab: https://gitlab.haskell.org/ghc/ghc/-/commit/2643ba465cd2a133b6f495f34fc59cd1a6d23525
You're receiving this email because of your account on gitlab.haskell.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.haskell.org/pipermail/ghc-commits/attachments/20200324/7eed0f44/attachment.html>


More information about the ghc-commits mailing list