<html><head></head><body><div class="ydpb6b3c7c7yahoo-style-wrap" style="font-family:courier new, courier, monaco, monospace, sans-serif;font-size:13px;"><div></div>
<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 <noonsilk@gmail.com> 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">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">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">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/">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">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></body></html>