Simon Peyton Jones
π€ SpeakerAppearances Over Time
Podcast Appearances
I could put foo in a data structure.
I could return foo as a result.
It's a value just as much as three or plus three.
In particular, for example, I could say, do foo, semicolon, foo.
That takes foo, uses it twice.
Each time, do foo, semicolon, foo says, do foo, and then do foo again.
So I'll read a character and print it, and then read a character and print it again.
So these values of type IOT, for subtype T, are first-class values.
Right.
In C, I can't take X colon equals three semicolon, you know, Y plus four and pass that as an argument to something and expect it to happen wherever it's used.
Right.
It's not a first class value.
Oh, because we are lying.
But look, if your function has int arrow int,
Can it do any I.O.?
No.
No.
If it has type int to I.O.
int, it could do arbitrary I.O.
So yes.