diff options
author | Simon Marlow <marlowsd@gmail.com> | 2016-04-15 16:24:59 -0700 |
---|---|---|
committer | Simon Marlow <marlowsd@gmail.com> | 2016-04-26 16:00:43 +0100 |
commit | d396996298939f647c22b547bc01f1b00e6e2fd9 (patch) | |
tree | 97a6b7cfa6b3bfa52cd356343e74f93d0e71f508 /docs | |
parent | 95f9334aeeebc8708ed89a5d985b6be3e8a3f1da (diff) | |
download | haskell-d396996298939f647c22b547bc01f1b00e6e2fd9.tar.gz |
Doc improvement for ApplicativeDo
Make it clearer that the final statement should be exactly
"(return|pure) E".
Diffstat (limited to 'docs')
-rw-r--r-- | docs/users_guide/glasgow_exts.rst | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/docs/users_guide/glasgow_exts.rst b/docs/users_guide/glasgow_exts.rst index b88cf44860..ef66140094 100644 --- a/docs/users_guide/glasgow_exts.rst +++ b/docs/users_guide/glasgow_exts.rst @@ -943,6 +943,11 @@ then the expression will only require ``Applicative``. Otherwise, the expression will require ``Monad``. The block may return a pure expression ``E`` depending 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. In particular, +``return $ E`` is not of the form ``return E``, and will therefore +incur a ``Monad`` constraint. + When the statements of a ``do`` expression have dependencies between them, and ``ApplicativeDo`` cannot infer an ``Applicative`` type, it uses a heuristic algorithm to try to use ``<*>`` as much as possible. |