streamly icon indicating copy to clipboard operation
streamly copied to clipboard

This library is great

Open stuser81 opened this issue 2 years ago • 2 comments

Can you name some other languages where something like streamly would be possible to do (or already exists)?

Something where you get all the benefits of streamly (working on one component in an isolated (and possibly even pure) way, etc.) while getting the compiler to optimize it for you into a tight for-loop.

stuser81 avatar Jun 15 '22 12:06 stuser81

(I'm curious to learn if really only Haskell can currently pull this off.)

stuser81 avatar Jun 15 '22 12:06 stuser81

There are streaming/reactive libraries in other languages e.g. Apache Flink (Java/Scala), or ReactiveX. But I am not sure whether it is possible to get in other languages the high degree of modularity, composability and clear reasoning that we get in Haskell.

Streamly is not a niche or special purpose library, unlike streaming libraries in other languages, you can express general purpose programming problems with it. The combinators elegantly build upon lower level building blocks in an idiomatic fashion and yet provide high performance.

All that is possible because of Haskell purity which in turn allows GHC to reason about the code and perform optimizations like case-of-case and spec-constr; it allows us to combine loop fragments from modular building blocks, creating tight loops with high performance, without boxing of intermediate data. I would not try this in other languages that I know of. I am basically a C programmer and looked at most of the available languages before deciding on using Haskell to do something like this.

harendra-kumar avatar Jun 15 '22 13:06 harendra-kumar