summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Jakobi <simon.jakobi@gmail.com>2020-04-02 08:04:24 +0200
committerSimon Jakobi <simon.jakobi@gmail.com>2020-04-02 08:04:24 +0200
commitbb64dae2e12d88df8dad650a953b09d4cc73c9b2 (patch)
tree6dc1892768557eb756d1953d18443f5845498937
parent3c09f636a459f50119bfbb5bf798b9a9e19eb464 (diff)
downloadhaskell-wip/sjakobi/no-applicativedo.tar.gz
Avoid references to ApplicativeDo in the base haddockswip/sjakobi/no-applicativedo
…to avoid information overload.
-rw-r--r--libraries/base/Data/Void.hs4
-rw-r--r--libraries/base/GHC/Base.hs20
2 files changed, 4 insertions, 20 deletions
diff --git a/libraries/base/Data/Void.hs b/libraries/base/Data/Void.hs
index 5c2886889b..f9902b4936 100644
--- a/libraries/base/Data/Void.hs
+++ b/libraries/base/Data/Void.hs
@@ -79,7 +79,7 @@ absurd a = case a of {}
-- | If 'Void' is uninhabited then any 'Functor' that holds only
-- values of type 'Void' is holding no values.
--
--- Using @ApplicativeDo@: \'@'vacuous' theVoid@\' can be understood as the
+-- Assuming that @f@ is also a 'Monad', @('vacuous' theVoid)@ can be understood as the
-- @do@ expression
--
-- @
@@ -87,8 +87,6 @@ absurd a = case a of {}
-- pure (absurd void)
-- @
--
--- with an inferred @Functor@ constraint.
---
-- @since 4.8.0.0
vacuous :: Functor f => f Void -> f a
vacuous = fmap absurd
diff --git a/libraries/base/GHC/Base.hs b/libraries/base/GHC/Base.hs
index 610e2996a8..91925f0d81 100644
--- a/libraries/base/GHC/Base.hs
+++ b/libraries/base/GHC/Base.hs
@@ -486,30 +486,26 @@ the first law, so you need only check that the former condition holds.
-}
class Functor f where
- -- | Using @ApplicativeDo@: \'@'fmap' f as@\' can be understood as
+ -- | Assuming that the 'Functor' is also a 'Monad', @('fmap' f as)@ can be understood as
-- the @do@ expression
--
-- @
-- do a <- as
-- pure (f a)
-- @
- --
- -- with an inferred @Functor@ constraint.
fmap :: (a -> b) -> f a -> f b
-- | Replace all locations in the input with the same value.
-- The default definition is @'fmap' . 'const'@, but this may be
-- overridden with a more efficient version.
--
- -- Using @ApplicativeDo@: \'@a '<$' bs@\' can be understood as the
+ -- Assuming that the 'Functor' is also a 'Monad', @(a '<$' bs)@ can be understood as the
-- @do@ expression
--
-- @
-- do bs
-- pure a
-- @
- --
- -- with an inferred @Functor@ constraint.
(<$) :: a -> f b -> f a
(<$) = fmap . const
@@ -622,22 +618,12 @@ class Functor f => Applicative f where
-- | Sequence actions, discarding the value of the first argument.
--
- -- \'@as '*>' bs@\' can be understood as the @do@ expression
+ -- @(as '*>' bs)@ can be understood as the @do@ expression
--
-- @
-- do as
-- bs
-- @
- --
- -- This is a tad complicated for our @ApplicativeDo@ extension
- -- which will give it a @Monad@ constraint. For an @Applicative@
- -- constraint we write it of the form
- --
- -- @
- -- do _ <- as
- -- b <- bs
- -- pure b
- -- @
(*>) :: f a -> f b -> f b
a1 *> a2 = (id <$ a1) <*> a2
-- This is essentially the same as liftA2 (flip const), but if the