[commit: packages/base] ghc-7.8: Tweak Haddock markup in Control.Applicative (7d7f010)
git at git.haskell.org
git at git.haskell.org
Tue Feb 25 11:05:01 UTC 2014
Repository : ssh://git@git.haskell.org/base
On branch : ghc-7.8
Link : http://ghc.haskell.org/trac/ghc/changeset/7d7f010e0b5c4cd738307bac533ce66c6467c5cf/base
>---------------------------------------------------------------
commit 7d7f010e0b5c4cd738307bac533ce66c6467c5cf
Author: Herbert Valerio Riedel <hvr at gnu.org>
Date: Sun Feb 16 21:59:31 2014 +0100
Tweak Haddock markup in Control.Applicative
This (arguably) improves rendering with Haddock 2.14
Signed-off-by: Herbert Valerio Riedel <hvr at gnu.org>
(cherry picked from commit b3307dc871503ead93771b2096b819273cd129a6)
>---------------------------------------------------------------
7d7f010e0b5c4cd738307bac533ce66c6467c5cf
Control/Applicative.hs | 31 ++++++++++++++++++-------------
1 file changed, 18 insertions(+), 13 deletions(-)
diff --git a/Control/Applicative.hs b/Control/Applicative.hs
index dbfa272..8f72521 100644
--- a/Control/Applicative.hs
+++ b/Control/Applicative.hs
@@ -27,9 +27,9 @@
-- it admits more sharing than the monadic interface. The names here are
-- mostly based on parsing work by Doaitse Swierstra.
--
--- For more details, see /Applicative Programming with Effects/,
--- by Conor McBride and Ross Paterson, online at
--- <http://www.soi.city.ac.uk/~ross/papers/Applicative.html>.
+-- For more details, see
+-- <http://www.soi.city.ac.uk/~ross/papers/Applicative.html Applicative Programming with Effects>,
+-- by Conor McBride and Ross Paterson.
module Control.Applicative (
-- * Applicative functors
@@ -73,34 +73,39 @@ infixl 4 <*>, <*, *>, <**>
-- functions satisfying the following laws:
--
-- [/identity/]
+--
-- @'pure' 'id' '<*>' v = v@
--
-- [/composition/]
+--
-- @'pure' (.) '<*>' u '<*>' v '<*>' w = u '<*>' (v '<*>' w)@
--
-- [/homomorphism/]
+--
-- @'pure' f '<*>' 'pure' x = 'pure' (f x)@
--
-- [/interchange/]
+--
-- @u '<*>' 'pure' y = 'pure' ('$' y) '<*>' u@
--
-- The other methods have the following default definitions, which may
-- be overridden with equivalent specialized implementations:
--
--- @
--- u '*>' v = 'pure' ('const' 'id') '<*>' u '<*>' v
--- u '<*' v = 'pure' 'const' '<*>' u '<*>' v
--- @
+-- * @u '*>' v = 'pure' ('const' 'id') '<*>' u '<*>' v@
+--
+-- * @u '<*' v = 'pure' 'const' '<*>' u '<*>' v@
--
-- As a consequence of these laws, the 'Functor' instance for @f@ will satisfy
--
--- @
--- 'fmap' f x = 'pure' f '<*>' x
--- @
+-- * @'fmap' f x = 'pure' f '<*>' x@
+--
+-- If @f@ is also a 'Monad', it should satisfy
+--
+-- * @'pure' = 'return'@
+--
+-- * @('<*>') = 'ap'@
--
--- If @f@ is also a 'Monad', it should satisfy @'pure' = 'return'@ and
--- @('<*>') = 'ap'@ (which implies that 'pure' and '<*>' satisfy the
--- applicative functor laws).
+-- (which implies that 'pure' and '<*>' satisfy the applicative functor laws).
class Functor f => Applicative f where
-- | Lift a value.
More information about the ghc-commits
mailing list