Simon Peyton Jones
π€ SpeakerAppearances Over Time
Podcast Appearances
As a sort of unintended consequence of being called by value, it was also by default impure.
Now, good OCaml programmers won't use many side effects, but OCaml doesn't prevent you.
Haskell prevents you.
Why does it prevent you?
Because if we'd allowed you to say F of print hello, print goodbye, those would be thunks, right?
Not yet evaluated, right?
So if F happened to evaluate its first argument and then its second, we'd print hello and then goodbye.
If it evaluated its second and then its first, we'd print goodbye and then hello.
If it didn't evaluate either, we wouldn't print either of them.
That doesn't sound very good if you want to control what IO is happening.
Laziness forced Haskell to stay pure.
Strictness allowed OCaml, which grew out of the ML tradition, by the way.
ML is another functional language that predated Haskell.
It was always strict, and it always had IO by default.
It wasn't a goal, but that's just the way it worked out.
At the time, nobody thought about it.
It was just obvious.
So that's a big difference between OCaml and Haskell, right?
Now then, since then, they've both grown up.
Haskell's gained sort of monads.