3 ms·
Slightly off topic, but I've been working in Haskell, and recently realized how the laziness of the language means everything is basically asynchronous by defau
by rtpg 13y ago
Slightly off topic, but I've been working in Haskell, and recently realized how the laziness of the language means everything is basically asynchronous by default, but you can still write your code in a synchronous fashion. No real need for promises or callbacks because lazy values are the promises. Well, when using lazy IO, at least.
I'd actually much prefer lazy values be put into Javscript than almost any other feature (real module support is another big one).
- ilaksh 13y agoSee my comment below about ToffeeScript which compiles to JavaScript.
- rapala 13y agoThen again, Simon Peyton Jones has said that were he to make a new Haskell, it would have strict evaluation. As far as I know, lazy IO is considered a pain in the butt. That beeing said, laziness does have its merits and some ideas can be elegantly stated in a lazy language.
- rtpg 13y agodo you have a source on this? For me laziness is the single strongest thing going for Haskell.
- rapala 13y agoIt's from a retrospective on Haskell: www.cs.nott.ac.uk/~gmh/appsem-slides/peytonjones.ppt There seems to be two arguments against laziness. Firstly, it makes reasoning about performance hard. Secondly, forcing strict evaluation is tricky, maybe harder than it would be to do optional lazy evaluation in a strict language.
- audreyt 13y agoThe default Lazy IO issue has been addressed in pipes-bytestring: http://www.haskellforall.com/2013/09/perfect-streaming-using-pipes-bytestring.html http://www.haskellforall.com/2013/09/perfect-streaming-using... The pipes ecosystem ( http://www.haskell.org/haskellwiki/Pipes http://www.haskell.org/haskellwiki/Pipes ) is working well to offer {effects, streaming, composability} without the resource leak issues introduced by lazy IO.