Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
Open sidebar
Shayne Fletcher
Glasgow Haskell Compiler
Commits
ee3bde79
Commit
ee3bde79
authored
Jun 20, 2016
by
Simon Marlow
Browse files
Expand and clarify the docs for ApplicativeDo (#11835)
parent
e170d197
Changes
1
Hide whitespace changes
Inline
Sidebyside
Showing
1 changed file
with
15 additions
and
3 deletions
+15
3
docs/users_guide/glasgow_exts.rst
docs/users_guide/glasgow_exts.rst
+15
3
No files found.
docs/users_guide/glasgow_exts.rst
View file @
ee3bde79
...
...
@@ 858,9 +858,21 @@ 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
.
Using
``$``
as
in
``
return
$
E
``
or
``
pure
$
E
``
is
also
acceptable
.
Note
:
the
final
statement
must
match
one
of
these
patterns
exactly
:

``
return
E
``

``
return
$
E
``

``
pure
E
``

``
pure
$
E
``
otherwise
GHC
cannot
recognise
it
as
a
``
return
``
statement
,
and
the
transformation
to
use
``<$>``
that
we
saw
above
does
not
apply
.
In
particular
,
slight
variations
such
as
``
return
.
Just
$
x
``
or
``
let
x
=
e
in
return
x
``
would
not
be
recognised
.
If
the
final
statement
is
not
of
one
of
these
forms
,
GHC
falls
back
to
standard
``
do
``
desugaring
,
and
the
expression
will
require
a
``
Monad
``
constraint
.
When
the
statements
of
a
``
do
``
expression
have
dependencies
between
them
,
and
``
ApplicativeDo
``
cannot
infer
an
``
Applicative
``
type
,
it
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment