## The IO Monad is 45 years old

Oleg Kiselyov wrote a mail to haskell-cafe today titled, The IO Monad is 45 years old. I thought LtU readers might like this.

## Comment viewing options

### Monads are at least 62 years old

As Neel has pointed out here on LtU, monads are at least 62 years old.

### That is stretching things too far

Certainly 'modalities' in logic are at least 62 years old (in fact, several centuries old, as Leibniz was well aware of them). But to thereby jump to monads (as type constructors satisfying certain laws) via the Curry-Howard correspondance asserts too much clairvoyance on our (otherwise brilliant) mathematical ancestors. Curry understood that he was seeing something interesting and important, but to say that he saw a 'monad' is too much. (Read it yourself, chapter 5 of A Theory of Formal Deducibity).

Oleg's claim that the IO Monad is 45 years old is much better supported by Landin's text. Landin did not see 'monad', but he definitely saw all the operational details of the IO Monad, in a denotationally very clear manner.

### Cool!

I didn't realize that his notes were available online -- thanks for the link.

### That is 1949, baby boom days

That is 1948-9, baby boom days after WWII ended.

### Arguable

Landin's implementation of state threading is not very accurate - it depends on applicative-order evaluation, in particular side-effects in the discarded argument of the K combinator. Also the token representing the state of the world is discarded and regenerated, which rather undermines the whole point.

         Algol 60     |          Lambda Calculus
x:=  2;      |   ( (\() -> K () (assignandhold x 2)) .
x:=  -3;     |     (\() -> K () (assignandhold x (-3))) )  ()


A correct implementation needs to change the assignandhold function to take the state of the world as an argument and return it. There's no need for games with the K combinator. Then function composition threads the world through directly.

         ( (\world -> assignandhold x 2 world) .
(\world -> assignandhold x (-3) world) )  world


i.e.

         ( (assignandhold x 2) .
(assignandhold x (-3)) )  world