Live data from Hacker News

Show HN: Lfi – a lazy functional sync, async, and concurrent iteration library

lfi.dev

11–20 of 51 posts

Re: Show HN: Lfi – a lazy functional sync, async, and concurrent iteration library

#13

Were you aware of IxJS [0]? I've used that to good success over the years. It's relationship to RxJS keeps it familiar. Any thoughts on what Lfi does better/different than IxJS? [0] https://github.com/ReactiveX/IxJS

I was not aware of it! As far as I can tell, it has some similar ideas (and seems pretty nice!), but I noticed the following differences: - I don't _think_ it supports "concurrent" iteration [1] - It doesn't have a "reducer" concept with composition and what not [2] - It doesn't have a concept of "optionals" [3] [1] https://lfi.dev/docs/concepts/concurrent-iterable [2] https://lfi.dev/docs/concepts/reducer [3] https:…

> I don't _think_ it supports "concurrent" iteration

I believe what you are calling a "concurrent" iteration is one of the use cases for Observables, so would be on the RxJS side (the "parent" project).

> It doesn't have a "reducer" concept with composition and what not

Interesting. I'll read further on what you are doing there. Seems possibly similar to Lenses/Prisms in FP, with different rules.

> It doesn't have a concept of "optionals"

Good point. So far I've not found a JS approach to optionals I'm entirely happy with. I've had some suggest I should give Effect [0] a deeper look, but given I'm mostly happy with RxJS the bulk of Effect doesn't appeal to me. The dual of an Option being an iterator with 0 or 1 values is something I've seen before and something to keep in mind.

[0] https://effect.website/docs/data-types/option/

Re: Show HN: Lfi – a lazy functional sync, async, and concurrent iteration library

#14

Earlier quoted context omitted.

I was not aware of it! As far as I can tell, it has some similar ideas (and seems pretty nice!), but I noticed the following differences: - I don't _think_ it supports "concurrent" iteration [1] - It doesn't have a "reducer" concept with composition and what not [2] - It doesn't have a concept of "optionals" [3] [1] https://lfi.dev/docs/concepts/concurrent-iterable [2] https://lfi.dev/docs/concepts/reducer [3] https:…

> I don't _think_ it supports "concurrent" iteration I believe what you are calling a "concurrent" iteration is one of the use cases for Observables, so would be on the RxJS side (the "parent" project). > It doesn't have a "reducer" concept with composition and what not Interesting. I'll read further on what you are doing there. Seems possibly similar to Lenses/Prisms in FP, with different rules. > It doesn't have a…

> I believe what you are calling a "concurrent" iteration is one of the use cases for Observables, so would be on the RxJS side (the "parent" project).

Ah, got it. I don't think I quite understood the relationship between this project and RxJS. I did know about RxJS's observables, yes. I do sort of hint at the relationship between concurrent iterables and the observables [1], but I tried to make concurrent iterables a bit more specialized to what you'd normally use an iterable for.

> Interesting. I'll read further on what you are doing there. Seems possibly similar to Lenses/Prisms in FP, with different rules.

I think I've heard of lenses (but not prisms), but don't think I ever actually learned what they are. Would be curious if you find a connection between those and my reducers :)

> Good point. So far I've not found a JS approach to optionals I'm entirely happy with. I've had some suggest I should give Effect [0] a deeper look, but given I'm mostly happy with RxJS the bulk of Effect doesn't appeal to me. The dual of an Option being an iterator with 0 or 1 values is something I've seen before and something to keep in mind.

Yeah, I liked representing optionals as iterables because you get a lot of functionality for "free" [2]

[1] https://lfi.dev/docs/concepts/concurrent-iterable#:~:text=A%....

[2] https://lfi.dev/docs/concepts/optional#why-use-iterables-to-...

Re: Show HN: Lfi – a lazy functional sync, async, and concurrent iteration library

#15

Earlier quoted context omitted.

> I don't _think_ it supports "concurrent" iteration I believe what you are calling a "concurrent" iteration is one of the use cases for Observables, so would be on the RxJS side (the "parent" project). > It doesn't have a "reducer" concept with composition and what not Interesting. I'll read further on what you are doing there. Seems possibly similar to Lenses/Prisms in FP, with different rules. > It doesn't have a…

> I believe what you are calling a "concurrent" iteration is one of the use cases for Observables, so would be on the RxJS side (the "parent" project). Ah, got it. I don't think I quite understood the relationship between this project and RxJS. I did know about RxJS's observables, yes. I do sort of hint at the relationship between concurrent iterables and the observables [1], but I tried to make concurrent iterables…

Prisms are Lenses through Options. They compose very similarly to Lenses and it is easy to convert a Lens to a Prism to compose Prisms from existing Lenses. Every Lens is a very simple "degenerate" Reducer (a Lens is just a getter and a setter from one "state" to another), but Prisms feel even more like "real" Reducers because of the optional states that can be involved. So Prisms and Lenses are very common composable Reducers in some styles of FP.

Re: Show HN: Lfi – a lazy functional sync, async, and concurrent iteration library

#18

Call me an idiot, but nowhere on the home page does it say it's for JavaScript. The code samples looked like JS, but I don't know every language, so I wasn't sure. It's not until I got into the docs and saw "npm" was a sure we were talking about JS...

Was gonna post some snark about assumed languages, countries, etc, now i think there could be an interesting post in that..

Re: Show HN: Lfi – a lazy functional sync, async, and concurrent iteration library

#19

Call me an idiot, but nowhere on the home page does it say it's for JavaScript. The code samples looked like JS, but I don't know every language, so I wasn't sure. It's not until I got into the docs and saw "npm" was a sure we were talking about JS...

Should be renamed to lfi.js
Post reply on HN