Re:I would like a job writing Haskell
by eru on Tuesday February 08, 2022 @09:20AM
(#30258654)
Lazy made historical sense as a default: it forced them to deal with side-effects properly.
For a new language I would suggest that without annotation, only pure, total functions are allowed.
Haskell makes you annotate side-effecting functions with a tag (like IO). But it allows divergent and partial functions just fine. That's why they can't just remove the laziness.
I propose that the latter would also need a tag.
The nice thing about total functions is that the choice between evaluation orders becomes purely a matter of optimization, and won't change anything about semantics.
Some languages like Agda already do something a bit like this.
(Also note that total functions are not Turing complete. But that's a feature, not a bug.)
For a new language I would suggest that without annotation, only pure, total functions are allowed.
Haskell makes you annotate side-effecting functions with a tag (like IO). But it allows divergent and partial functions just fine. That's why they can't just remove the laziness.
I propose that the latter would also need a tag.
The nice thing about total functions is that the choice between evaluation orders becomes purely a matter of optimization, and won't change anything about semantics.
Some languages like Agda already do something a bit like this.
(Also note that total functions are not Turing complete. But that's a feature, not a bug.)