<div dir="ltr"><div dir="ltr"><div>ghci> :set -XBlockArguments<br></div><div>ghci> let be = id in do be do be do ()</div><div>()<br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Feb 21, 2024 at 3:18 AM 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></div>