From where this was previously discussed, as provided by jaror:
-
Monadic Bang: A plugin for more concise do-block notation, inspired by Idris - #16 by atravers
Call by Effect (2009)
…hence the final Caveat for monadic-bang
:
[…] the plugin is usually best used in situations where the order in which effects happen makes no difference.
(and the associated detail) along with my cautionary post earlier. As for that second Lean example:
def f (x y : Nat) : IO Unit := do
if (<- isGreaterThan0 x) && (<- isGreaterThan0 y) then
IO.println s!"{x} and {y} are greater than 0"
else
pure ()
Now just imagine the ordering of those side effects changing with each run of the program:
…it might just be easier to use Lean instead of trying to extend Haskell in this way.