Add a utility for creating events based on STM actions#440
Add a utility for creating events based on STM actions#440kmicklas wants to merge 2 commits intoreflex-frp:developfrom
Conversation
|
@kmicklas Just curious - what do you use this for (i.e., application use case)? |
|
@srid My use case is listening to global Android events. You can have Java call into Haskell with JNI, but to trigger a reflex event created with There are several non-ideal solutions I can think of:
My solution is to have the JNI handler write to a broacast |
|
I want to study the code a bit more, but your use case seems equally interesting and possibly a way to simplify the Android logic in Reflex-DOM which, as you say, is rather tricky. |
Feel free to reject this if it's too specific a use case, as it's just a thin wrapper around
newEventWithLazyTriggerWithOnComplete, but I found it useful for creating events which interface with external global triggers without leaking memory.Note that I didn't include the
OnCompletefunctionality since I didn't have a need for it.However, maybe it makes sense to have since it could work nicely with the transactional part of STM.Edit: I realized this wouldn't work since triggering the reflex event inside the transaction doesn't make sense.