3 ms·
> because it's a language with strict evaluation But that is not the only reason. Haskell does much more aggressive optimisations than Java (and Scala, OCaml,
by willtim 6y ago
> because it's a language with strict evaluation
But that is not the only reason. Haskell does much more aggressive optimisations than Java (and Scala, OCaml, F#). A large part of Haskell's space-usage reasoning issues come from the combination of lazy evaluation and these aggressive optimisations. Java and Scala code can contain plenty of deferred evaluation too, for example iterators, but the compilers simply don't do (and cannot do) such aggressive optimisations. Of course, this also means that much pure functional Scala/Java code can be poorly performing.