News for hackers. Stuff that matters.
Re:Clojure Don’ts: Lazy Effects (2015) by willtim on Saturday March 03, 2018 @12:46PM (#16510461)
> I don't think it really makes sense to call the way side effects happen in Haskell "lazy".

I didn't actually say this. I was suggesting a lazy chain of IO actions for such problems. For example, ListT a IO, instead of a regular lazy list with hidden side-effects. The Haskell types help make the distinction clear.

> Instead, your program returns a pure structure which describes how side effects should be executed

Yes exactly, the pure structure can still be computed lazily on demand, providing IO actions.

My favourite Hackage streaming library for Haskell is "streaming" and it can work exactly this way.

Re:Clojure Don’ts: Lazy Effects (2015) by Tarean on Saturday March 03, 2018 @08:10PM (#16512723)
Worth noting that ListTs bind isn't associative for most base monads including IO and it is deprecated for a reason.

Also, by it's nature ListT can't stream IO unless you use lazy IO aka lazyRead aka unsafeInterleaveIO which deserves its name.

Re:Clojure Don’ts: Lazy Effects (2015) by willtim on Sunday March 04, 2018 @02:22AM (#16513651)
I am assuming "ListT done right" not the deprecated one (which is not even a chain of actions). Here is a definition, to be completely clear:

newtype ListT m a = ListT (m (Maybe (a, ListT m a)))

It is a nice simple example of an effectful streaming type.

> Also, by it's nature ListT can't stream IO

This is only true of the deprecated one, which is also misnamed. The community is rightly re-using the name for the behaviour shown above. See list-t on hackage, or the implementation that comes with Pipes.