<!DOCTYPE html>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
</head>
<body>
<p>Notably, it is not always useful to suggest removing the `do`,
e.g. I will often write that exact same `do`<br>
block with a let in it in tests, because it is very often the case
that later down the line I do end up wanting to<br>
use binds/stop using binds in the `do` block, and I personally
think the syntactic noise in the git diffs is not worth<br>
the (purely aesthetic?) benefit of not having the `do`.<br>
<br>
It's also useful if you're a fan of "abusing"(?)
BlockArguments+`do` to turn<br>
f<br>
(foo bar baz)<br>
(u v)<br>
<br>
to<br>
<br>
f<br>
do foo bar baz<br>
do u v<br>
</p>
<div class="moz-cite-prefix">On 2/21/24 17:27, Mark McConnell via
Haskell-Cafe wrote:<br>
</div>
<blockquote type="cite"
cite="mid:731751700.2902199.1708529228909@mail.yahoo.com">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<div class="ydpb6b3c7c7yahoo-style-wrap"
style="font-family:courier new, courier, monaco, monospace, sans-serif;font-size:13px;">
<div dir="ltr" data-setdir="false">To my surprise, hlint
(version 3.3.6) did not suggest taking out the do. I ran the
following through hlint.</div>
<div dir="ltr" data-setdir="false"><br>
</div>
<div dir="ltr" data-setdir="false">
<div>
<div>jk :: Bool</div>
<div>jk = do</div>
<div> let x = False</div>
<div> not x</div>
<div><br>
</div>
</div>
<span></span><span></span><br>
</div>
<div><br>
</div>
</div>
<div id="yahoo_quoted_8796580932" class="yahoo_quoted">
<div
style="font-family:'Helvetica Neue', Helvetica, Arial, sans-serif;font-size:13px;color:#26282a;">
<div> On Wednesday, February 21, 2024 at 04:23:49 AM EST, Noon
van der Silk <a class="moz-txt-link-rfc2396E" href="mailto:noonsilk@gmail.com"><noonsilk@gmail.com></a> wrote: </div>
<div><br>
</div>
<div><br>
</div>
<div>
<div id="yiv6026152234">
<div>
<div dir="ltr">Yeah, it's a bit confusing; I think some
tutorials/books do go over the `do` simplification
steps. I guess conceptually `do` doesn't mean
`Definitely a Monad`, it means `Maybe a Monad` or more
`Probably should be a Monad, and if not, just remove
the do!`.</div>
<br clear="none">
<div id="yiv6026152234yqt65622"
class="yiv6026152234yqt1068239424">
<div class="yiv6026152234gmail_quote">
<div dir="ltr" class="yiv6026152234gmail_attr">On
Wed, 21 Feb 2024 at 09:18, Johannes Waldmann <<a
rel="nofollow noopener noreferrer" shape="rect"
ymailto="mailto:johannes.waldmann@htwk-leipzig.de" target="_blank"
href="mailto:johannes.waldmann@htwk-leipzig.de"
moz-do-not-send="true"
class="moz-txt-link-freetext">johannes.waldmann@htwk-leipzig.de</a>>
wrote:<br clear="none">
</div>
<blockquote
style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex;"
class="yiv6026152234gmail_quote">Dear Cafe,<br
clear="none">
<br clear="none">
I was surprised to see ghc accept this code<br
clear="none">
<br clear="none">
ghci> do let {x = False}; not x<br clear="none">
True<br clear="none">
<br clear="none">
because I initially thought: there's a `do`, so
there must be some monad,<br clear="none">
but which is it? some implicit Identity monad
perhaps?<br clear="none">
<br clear="none">
But the type is indeed plain `Bool`, and the
explanation is (I think):<br clear="none">
there is a `do` but there is no monad, since the
translation according to<br clear="none">
( <a rel="nofollow noopener noreferrer"
shape="rect" target="_blank"
href="https://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-470003.14"
moz-do-not-send="true"
class="moz-txt-link-freetext">https://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-470003.14</a>
)<br clear="none">
does never produce `(>>=)`.<br clear="none">
<br clear="none">
So, all is fine, nothing to see here.<br
clear="none">
Perhaps keep in mind as an edge case, useful to
confuse students.<br clear="none">
Actually, to motivate them to read the language
standard ...<br clear="none">
<br clear="none">
- J.W.<br clear="none">
_______________________________________________<br
clear="none">
Haskell-Cafe mailing list<br clear="none">
To (un)subscribe, modify options or view archives
go to:<br clear="none">
<a rel="nofollow noopener noreferrer" shape="rect"
target="_blank"
href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe"
moz-do-not-send="true"
class="moz-txt-link-freetext">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br
clear="none">
Only members subscribed via the mailman list are
allowed to post.</blockquote>
</div>
</div>
<br clear="all">
<div><br clear="none">
</div>
<span class="yiv6026152234gmail_signature_prefix">-- </span><br
clear="none">
<div dir="ltr" class="yiv6026152234gmail_signature">
<div dir="ltr">
<div dir="ltr">Noon van der Silk<br clear="none">
<br clear="none">
<a rel="nofollow noopener noreferrer" shape="rect"
target="_blank" href="http://silky.github.io/"
moz-do-not-send="true"
class="moz-txt-link-freetext">http://silky.github.io/</a><br
clear="none">
<br clear="none">
"My programming language is kindness."</div>
</div>
</div>
</div>
</div>
<div class="yqt1068239424" id="yqt13035">_______________________________________________<br
clear="none">
Haskell-Cafe mailing list<br clear="none">
To (un)subscribe, modify options or view archives go to:<br
clear="none">
<a shape="rect"
href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe"
target="_blank" moz-do-not-send="true"
class="moz-txt-link-freetext">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br
clear="none">
Only members subscribed via the mailman list are allowed
to post.</div>
</div>
</div>
</div>
<br>
<fieldset class="moz-mime-attachment-header"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
<a class="moz-txt-link-freetext" href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a>
Only members subscribed via the mailman list are allowed to post.</pre>
</blockquote>
</body>
</html>