The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
At least it lets you apply a function to a string and get back another string.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
So, of course, we then worked on how could we do IO in Haskell in a safe way?
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
And that will lead to, you know, monads and stuff.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
So just as we're moving from C horizontally to go safer and safer, but staying useful.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
So from Haskell, we're moving sort of vertically to get more and more useful without stopping being safe.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
And Nirvana is when we sort of meet up, right?
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
But the point is not to say one is better than the other, but just to say that we both seek things that are useful and safe.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
So when you say F applied to 3 plus 4, it'll add 3 plus 4 and then call F to get 7 right.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
In our school, if you say F of 3 plus 4, it'll build a little suspension that says, well, if you ever need this 3 plus 4, you can evaluate it, but maybe you'll never need it.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
And then it calls F. That's a lazy language.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
So because OCaml is strict, it has a defined order of evaluation.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
So if you say f of 3 plus 4 and a second parameter 8 plus 9, it'll evaluate 3 plus 4 and then 8 plus 9 in that order.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
So it makes sense to say you can say f of print hello, print goodbye.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
Because you get hello and then goodbye printed.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
So once you have a defined order of evaluation, then it's pretty easy to incorporate I.O.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
Even though it quotes a functional language,
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
OCaml allows you to do I.O.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
without saying unsafe perform I.O.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
or anything.
The Peterman Pod
Co-Creator of Haskell: Functional Programming, Thinking in Types, Useless Languages | Simon Jones
In fact, it has a defined order of evaluation and it's perfectly kosher to do that.