Re: what monad is this?

Brent Yorgey <[email protected]>
Newsgroups gmane.comp.lang.haskell.cafe
Message-ID <CAH0njdtpLU2zqC3133Bf=pPASX7RVpN1WA3Z3X-WPUrN+AMcsA@mail.gmail.com>
ghci> :set -XBlockArguments
ghci> let be = id in do be do be do ()
()

On Wed, Feb 21, 2024 at 3:18 AM Johannes Waldmann <
[email protected]> wrote:

> Dear Cafe,
>
> I was surprised to see  ghc  accept this code
>
> ghci> do let {x = False}; not x
> True
>
> because I initially thought: there's a `do`, so there must be some monad,
> but which is it? some implicit Identity monad perhaps?
>
> But the type is indeed plain `Bool`, and the explanation is (I think):
> there is a `do` but there is no monad, since the translation according to
> (
> https://www.haskell.org/onlinereport/haskell2010/haskellch3.html#x8-470003.14
> )
> does never produce `(>>=)`.
>
> So, all is fine, nothing to see here.
> Perhaps keep in mind as an edge case, useful to confuse students.
> Actually, to motivate them to read the language standard ...
>
> - J.W.
> _______________________________________________
> Haskell-Cafe mailing list
> To (un)subscribe, modify options or view archives go to:
> http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
> Only members subscribed via the mailman list are allowed to post.

_______________________________________________
Haskell-Cafe mailing list
To (un)subscribe, modify options or view archives go to:
http://mail.haskell.org/cgi-bin/mailman/listinfo/haskell-cafe
Only members subscribed via the mailman list are allowed to post.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.