summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorUtku Demir <me@utdemir.com>2021-02-23 12:35:38 +1300
committerMarge Bot <ben+marge-bot@smart-cactus.org>2021-02-25 19:26:50 -0500
commitbc12e7ecfc9f1792bf3f97e676383d83bb55ffc1 (patch)
treee2cfc57f28aa14c7470e04634298597d5d7927b4
parent10e115d39d6062151cc95256fee052b197a46186 (diff)
downloadhaskell-bc12e7ecfc9f1792bf3f97e676383d83bb55ffc1.tar.gz
Minor fix to QualifiedDo docs about the ApplicativeDo desugaring
When desugaring ApplicativeDo, GHC looks up the name `fmap`, not `<$>` (see 'GHC.Builtin.Names.fmapName'). This commit fixes the misleading documentation; since exporting the name `<$>` instead of `fmap` causes a "not in scope" error when `QualifiedDo` and `ApplicativeDo` is combined. [skip ci]
-rw-r--r--docs/users_guide/exts/qualified_do.rst6
1 files changed, 3 insertions, 3 deletions
diff --git a/docs/users_guide/exts/qualified_do.rst b/docs/users_guide/exts/qualified_do.rst
index 4a4eabc1b2..71c43c5655 100644
--- a/docs/users_guide/exts/qualified_do.rst
+++ b/docs/users_guide/exts/qualified_do.rst
@@ -84,14 +84,14 @@ The semantics of ``do`` notation statements with ``-XQualifiedDo`` is as follows
M.do { pat <- u; stmts } = u M.>>= \case pat -> M.do { stmts }
-* The desugaring of ``-XApplicativeDo`` uses ``(M.<$>)``, ``(M.<*>)``,
+* The desugaring of ``-XApplicativeDo`` uses ``M.fmap``, ``(M.<*>)``,
and ``M.join`` (after the the applicative-do grouping has been performed) ::
M.do { (x1 <- u1 | … | xn <- un); M.return e } =
- (\x1 … xn -> e) M.<$> u1 M.<*> … M.<*> un
+ (\x1 … xn -> e) `M.fmap` u1 M.<*> … M.<*> un
M.do { (x1 <- u1 | … | xn <- un); stmts } =
- M.join ((\x1 … xn -> M.do { stmts }) M.<$> u1 M.<*> … M.<*> un)
+ M.join ((\x1 … xn -> M.do { stmts }) `M.fmap` u1 M.<*> … M.<*> un)
Note that ``M.join`` is only needed if the final expression is not
identifiably a ``return``. With ``-XQualifiedDo`` enabled, ``-XApplicativeDo``