<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><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, 21 Feb 2024 at 09:18, Johannes Waldmann <<a href="mailto:johannes.waldmann@htwk-leipzig.de">johannes.waldmann@htwk-leipzig.de</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Dear Cafe,<br>
<br>
I was surprised to see ghc accept this code<br>
<br>
ghci> do let {x = False}; not x<br>
True<br>
<br>
because I initially thought: there's a `do`, so there must be some monad,<br>
but which is it? some implicit Identity monad perhaps?<br>
<br>
But the type is indeed plain `Bool`, and the explanation is (I think):<br>
there is a `do` but there is no monad, since the translation according to<br>
( <a href="https://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-470003.14" rel="noreferrer" target="_blank">https://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-470003.14</a> )<br>
does never produce `(>>=)`.<br>
<br>
So, all is fine, nothing to see here.<br>
Perhaps keep in mind as an edge case, useful to confuse students.<br>
Actually, to motivate them to read the language standard ...<br>
<br>
- J.W.<br>
_______________________________________________<br>
Haskell-Cafe mailing list<br>
To (un)subscribe, modify options or view archives go to:<br>
<a href="http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe" rel="noreferrer" target="_blank">http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe</a><br>
Only members subscribed via the mailman list are allowed to post.</blockquote></div><br clear="all"><div><br></div><span class="gmail_signature_prefix">-- </span><br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div dir="ltr">Noon van der Silk<br><br><a href="http://silky.github.io/" target="_blank">http://silky.github.io/</a><br><br>"My programming language is kindness."</div></div></div>