Open xvaldetaro opened 2 years ago
I could also write a small explanation of this closure-effect situation trick for newcomers. It was confusing for me. It is unintuitive that the external event acts like a "one off" effect and if you subscribe to it again you get another callback.
You were talking about
memoBeh
and I think it has the same functionality of replay. But I didn't code anything using closures like(AnEvent m a -> r) -> AnEvent m r)
. Instead I have everything returning am (AnEvent m r)
. I do have toClosure and fromEffect helper operators though.Now, I'm thinking if it makes sense to change all the operators here to the closure-style. I think the main use case of Hyrule and Paraglider is to use with Deku and I prefer making it as standard and ergonomic as possible. However, the closure style is totally alien to Rx people. Thus our initial goal of having a reference that Rx folks can look up to learn FRP would suffer a bit.
Wdyt? @mikesol
Hey, sorry I missed this before I started on PRs porting over stuff! I'll need to check out replay
(I'm not at my computer now) to see if it's the same as memoBeh
.
The closure stuff is really only useful to folks using a bolson-based lib like deku or ocarina. Otherwise, as you say, it's a head-scratcher. Recently, I've gone all-in on the hooks style, so I almost never see the closures anymore.
I think a good policy would be that anytime there's an operation that works both as a closure and something inside of m
, they should have a similar name and go in the same file. hyrule
already breaks this with memoize
and hot
.
How does that sound? If it's reasonable, what sort of naming convention would make sense?
I think the main usage of Hyrule and Paraglider is with Deku. Therefore I think making closure style the default is better because it can be used with the hooks style. Maybe just name myOperator
and myOperatorM
.
I think I actually prefer having the closure style on everything and add an operator to convert from closure to m
You were talking about
memoBeh
and I think it has the same functionality of replay. But I didn't code anything using closures like(AnEvent m a -> r) -> AnEvent m r)
. Instead I have everything returning am (AnEvent m r)
. I do have toClosure and fromEffect helper operators though.Now, I'm thinking if it makes sense to change all the operators here to the closure-style. I think the main use case of Hyrule and Paraglider is to use with Deku and I prefer making it as standard and ergonomic as possible. However, the closure style is totally alien to Rx people. Thus our initial goal of having a reference that Rx folks can look up to learn FRP would suffer a bit.
Wdyt? @mikesol