-
Notifications
You must be signed in to change notification settings - Fork 10
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Support for foldDynM-esque function? #54
Comments
Please ignore, this is wrong. Turns out I misunderstood what exactly Pull does. Here's my first attempt (UNTESTED!)
Do with that what you wish, you probably have a better feel than me for how to integrate this into the codebase. (Assuming it works at all, I out of time to test it today.) |
Ideally, one would be able to run |
@werner291 Hello, thanks for the question!
That's a very interesting suggestion. Can you elaborate? (Maybe an example of usage?) If I'm guessing correctly, you'd like a functionality similar to |
Hello! Yes, the whole In my case, I have to deal with a variable number of state machines. In more formal terms, suppose I have:
Now, I could use Preferably, I'd like to be able to turn it into some kind of So far, I think this should work https://github.com/werner291/purescript-specular/blob/feature/foldDynM/src/Specular/FRP/Base.purs#L510 Change to the code is pretty minimal (just replaced the Haven't had a chance to test it extensively, but this allows calling Even better in my particular use-case would be to somehow actually have the FRP plumbing do the routing for you, so that filtering on the tuple's key doesn't touch |
Perhaps relevant:
I already did this with effects (untested, but the idea should be clear). It's a bit unwieldy since I'm doing some Also, there is no cleanup here at all. |
What you're proposing is interesting, and is in my opinion generic enough to include in the library core. (If we could make the library API powerful enough so that it can be implemented externally - that would be even better!) However, there's a problem with your |
I see that Relfex has MonadHold. Perhaps we could take the I can understand arbitrary side-effects are an issue if we allow arbitrary effects. |
Curiously, it seems the Specular design is the opposite of Reflex: Reflex seems to treat |
Also, curiously, https://hackage.haskell.org/package/reflex-0.6/docs/Reflex-Class.html#t:PushM contains that fanout functionality that I proposed earlier in the thread. |
It, from what I can tell, is almost exactly what you're proposing: PushM implements limited functionality that allows to do some useful tricks inside the fold step function. |
Could start with something like this:
Then we implement the regular
Then we can create another monad that runs in the fold step function that also implements that class. |
How about this? It has the (NOTE: Still untested, but it seems to be going in the right direction. I can now directly use foldDyn in the step function, it compiles without issues.) |
Hello!
Any possibility to add support for some kind of
foldDyn
with monadic output, such as https://github.com/reflex-frp/reflex/blob/6cb58502c930e5eee88d007861881a43b7e2859a/src/Reflex/Dynamic.hs#L144I'll see if I can throw something together myself, but I'm afraid I don't quite know what exactly I'm doing.
The text was updated successfully, but these errors were encountered: