[GHC] #11835: ApplicativeDo failed to desugar last line with pure $ <expr>
GHC
ghc-devs at haskell.org
Mon Jun 20 17:21:07 UTC 2016
#11835: ApplicativeDo failed to desugar last line with pure $ <expr>
-------------------------------------+-------------------------------------
Reporter: Cosmia | Owner: simonmar
Type: bug | Status: merge
Priority: normal | Milestone: 8.0.2
Component: Compiler | Version: 8.0.1-rc2
Resolution: | Keywords: ApplicativeDo
Operating System: MacOS X | Architecture:
Type of failure: GHC rejects | Unknown/Multiple
valid program | Test Case:
Blocked By: | Blocking:
Related Tickets: #11607 | Differential Rev(s): Phab:D2345
Wiki Page: |
-------------------------------------+-------------------------------------
Comment (by chreekat):
Comment 6 provides the rationale for this situation, where the expected
behavior isn't really possible because of lower-level concerns.
Could that rationale be mentioned in the docs? Something like:
{{{
--- a/docs/users_guide/glasgow_exts.rst
+++ b/docs/users_guide/glasgow_exts.rst
@@ -860,7 +860,9 @@ upon the results ``p1...pn`` with either ``return`` or
``pure``.
Note: the final statement really must be of the form ``return E`` or
``pure E``, otherwise you get a ``Monad`` constraint. Using ``$`` as
-in ``return $ E`` or ``pure $ E`` is also acceptable.
+in ``return $ E`` or ``pure $ E`` is also acceptable. This is because we
+must spot the ``return`` before `GHC transforms do-syntax into fmap
+<https://ghc.haskell.org/trac/ghc/ticket/11835?replyto=6#comment:6>`_.
}}}
I've not had much experience contributing to GHC, so I apologize for the
unwieldy format of this suggestion.
--
Ticket URL: <http://ghc.haskell.org/trac/ghc/ticket/11835#comment:10>
GHC <http://www.haskell.org/ghc/>
The Glasgow Haskell Compiler
More information about the ghc-tickets
mailing list