Closed Marwes closed 3 years ago
This sounds like do
blocks from Haskell but more implicit. I may be biased by my narrow perspective as an amateur hobbyist, but I have always found do
blocks hard to understand and use because they obscure the mechanics and intuitions of monads.
I would personally prefer the compiler suggest lightweight combinator(s), like *>
or seq
, when offered consecutive monad expressions instead of silently accepting them.
Fair point. As a counter argument, I have always thought of do
blocks as a way to bridge the gap between imperative code and monadic one. So having the "default" way of writing sequential statements "just work" lets people coming from that angle still get stuff working without needing to grok monads.
bors r+
Made it so the formatter keeps seq
if it is written so both ways of writing it are equally viable now. Probably will end up removing one of the ways but for now this prevents people from writing it without seq
and being confused that nothing happens.
Build succeeded:
Rather than removing block expressions entirely, this changes them to behave as sequence (
seq
) expressions.