[Haskell-cafe] Wow Monads!
jo at durchholz.org
Wed Apr 19 18:39:06 UTC 2017
Am 19.04.2017 um 17:56 schrieb Sergiu Ivanov:
> I wanted to say that, when the typechecker sees a function of type
> IO (), it only knows that it _may_ have side effects, but it cannot
> verify that these effects compose correctly with the effects coming from
> other functions in the IO monad.
Even Haskell's type system is not able to classify and characterize side
I don't think that that's a defect in the type system though; I've had
my own experiences with trying to do that (based on design by contract,
if anybody is interested), and I found it's pretty much uncontrollable
unless you go for temporal logic, which is so hard to reason about that
I do not think it's going to be useful to most programmers. (Temporal
logic exists in several variants, so maybe I was just looking at the
>>> In fact, I believe having pure functions does not so much target
>>> removing state as it does making the state _explicit_.
>> Except State tends to make state implicit again, except for the fact
>> that there *is* state (which might be actually enough, I don't have
>> enough insight for any judgemental statements on the issue).
> Well, a typical definition of State is parameterised in the type of the
> state, so you know what it is.
> Sure, a typical definition of State does not let you know whether and
> how the state was modified, but if one wants that information, one can
> "just" define a custom "StateLog" monad, for example, or even use
> Applicative to statically "record" the effects on the state (I hear
> that's one use of Applicative).
Thanks, that's going to guide me in future attempts at understanding all
the strange and wondrous (and sometimes awesome) things you can find in
the Haskell ecology.
More information about the Haskell-Cafe