3 ms·
The -XStrict language extension is a lifesaver here, for when you want a language like Haskell but without lazy evaluation.
by logicchains 6y ago
The -XStrict language extension is a lifesaver here, for when you want a language like Haskell but without lazy evaluation.
- runeks 6y agoExcept it only lets you define your own strict functions and data structures — i.e. you still need to consider laziness when using existing libraries.
- zozbot234 6y agoIt's also not a very principled solution. It would be better to use focusing and/or polarized logic so as to allow both "strict" and "lazy" data and functions on a first-class basis. Then language-level options could be used to manage "defaults" as a matter of language syntax, for the programmer's convenience.
- whateveracct 6y agoPretty much every time I turn -XStrict on for some module I'm trying to optimize, performance gets worse. Laziness gets a lot of flak for being hard to reason about. I disagree - it's just different. But I never hear anyone acknowledge that laziness can bring compositional performance benefits no other language can sniff.
- jose_zap 6y agoThat’s because full laziness is actually an optimization strategy that Haskell uses to make programs faster. You are completely right about laziness being a big plus for composing functions.