5 ms·
Nice. But Laziness with I/O is not trivial at all.
by BlanketLogic 11y ago
Nice. But Laziness with I/O is not trivial at all.
- dllthomas 11y agoThat's true. An obvious solution is "keep IO out of your lazy computations", which hopefully you can get some language help with. There are some attempts at other approaches as well.
- LukeHoersten 11y agoHaskell has some great solutions for lazy IO: io-streams or pipes for example. Check them out! It's a great way to code IO.
- BlanketLogic 11y agoYes. Conduits and iteratees too, for that matter. And I believe, there was some talk about "Machines", which I did not understand at all. Am not sure what is the current status of that approach. I thought conduits and io-streams are preferred over pipes.
- codygman 11y agoAs I understand it in the Haskell community right now. 1. Pipes | Conduit 2. io-streams (perhaps not in 1 only because of a lack of popularity and it is new) 3. Iteratees (have some issue Pipes/Conduit do not which I can't recall) Not sure where Machines comes in here.
- LukeHoersten 11y agoio-streams is built specifically for IO and is in the IO monad. This allows for performance benefits as well as simplified API like using normal IO functions for error and resource handling (ex: `bracket` can be used)