2 ms·
> it's very hard to tell the difference between semantically important ordering and accidental ordering. Not when effects are clearly marked. There is zero dif
by pron 11y ago
> it's very hard to tell the difference between semantically important ordering and accidental ordering.
Not when effects are clearly marked. There is zero difference in that respect between continuations (i.e. imperative) and monads. It's only syntax and whatever your type system is.
> It's very normal to encapsulate something of that nature with a monad.
Sure, but a monad won't help you ensure their proper ordering.
- lmm 11y ago> Not when effects are clearly marked. There is zero difference in that respect between continuations (i.e. imperative) and monads. It's only syntax and whatever your type system is. Well, my experience is that refactoring code with an explicit =/<- distinction is much safer than refactoring in the presence of Java checked exceptions. That's my argument against any "effectfulMethod(); effectfulMethod();" style. I find it hard to understand what the change (compared to monads) you're advocating is. If you want to make the evaluation of a function not a value, then what semantics does it have? (and surely however elegant they are, having different semantics for the return value and the effects of a given call is always going to be more confusing than finding a way to express both in the same model). > Sure, but a monad won't help you ensure their proper ordering. It does. You can offer only safe operations - e.g. because I can use a monad to compose a sequence of database operations and store that as a value, I don't have to expose "begin transaction" and "end transaction" operations, only a "do this operation (potentially a composition of several operations and/or pure computations) in a transaction" operation.