Simon Peyton Jones
π€ SpeakerAppearances Over Time
Podcast Appearances
You can put in exclamation marks to say, please evaluate this before the call.
Or the IOMO now to say evaluate, but that's a more brutal, strict annotation.
In Haskell, you can make things stricter.
In OCaml, you can make things lazier.
It really boils down to, what's the default?
We both want to have a mixture of the two.
And then it becomes a bit cultural as to which you prefer.
I don't know.
Some people sometimes ask me, they say, well, if you were designing Haskell again, would you make it strict by default with really good support for laziness?
And I often say, well, I might.
Yeah, that does seem attractive because frequently I found myself cursing laziness as an implementer.
But I strongly suspect that 10 years after that, I'd be thinking,
Man, if only it was lazy by default.
Oh, when I say strict by default, I would definitely mean strict but pure.
Right, no side effects.
One way to think about it that's very easy to understand and use is just to imagine that the do notation is somehow built into Haskell.
So you can say do print x semicolon print y, and that has type.
IOUnit.
So a value of type IOUnit means I do some input output and return a value of type unit.
An expression of type IOUnit is an expression that when you run it will do some IOU and return an int.