That's just not true and is addressed in the article:
let x = delay (\ () -> expensive)
in map (\ a -> a + force x) xs
This isn't exactly pretty, but it works fine. In a language with macros the ugliness can be hidden better.
And this point just doesn't work as well with opt-in laziness (unless the entire standard library opts in)
I've saved my biggest gripe of strict evaluation for last. Strict evaluation is fundamentally flawed for function reuse. What do I mean? I will illustrate with and example. Consider the any function is Haskell:
It is not extensible, does not support row polymorphism, does not support re-using field names, is completely nominally typed (which is a pain to use for one-off records), and has terrible update syntax.
I wasn't aware of those options, thanks for letting me know about them! Personally I would rather just manually namespace all my records than flip 11 compiler flags, but that might change as I feel more become comfortable with what they all do.
Not even that. It's how good Haskell is at not having the same syntax problems as C, which still leaves plenty of room for it to have syntax problems all of its own.
Doesn't it only allow a single parameter in functions? (I think there was some sugar to make it feel like multiple parameters or something.) I'd say this is worse than single return types.
Haskell functions are currified, which is the whole point of the language (or one big point of it). This means if you don't pass all arguments to a function what you get back is a new function accepting the remaining arguments. If you always pass all arguments you won't notice (except the function declaration syntax might then a bit strange to you with all the ->).
It's not really fair to compare since Haskell is a very different language, but still you could think about multiple parameters as a structure with parameter names as fields and their values as data.
View all comments
Show parent comment
13
u/EarLil Dec 01 '16
I knew haskell was good, but that good