Hi,
I have recently implemented a modification debouncing mechanism for components I use at work, and I had to approach a following well-known problem: how to run a function like setTimeout :: Int -> Effect Unit -> Effect TimeoutId in the context of a HalogenM monad? I managed to get around this issue by using subscriptions and notifying in the second argument, but I don't really like the idea of creating a separate component action (actually, needing to have a concrete component in hand at all) just to be able to perform some HalogenM action in the Effect monad and lift the result back to the HalogenM.
So HalogenM should be enhanced with something like the Haskell's withRunInIO. I believe it can be done somehow - from my understanding we interpret a HalogenM monad in Aff using a reference for keeping a state, which somehow resembles the ReaderT IO monads which can easily be unlifted in IO. I can happily try to implement this feature, should you decide its worth having.
Hi,
I have recently implemented a modification debouncing mechanism for components I use at work, and I had to approach a following well-known problem: how to run a function like
setTimeout :: Int -> Effect Unit -> Effect TimeoutIdin the context of aHalogenMmonad? I managed to get around this issue by using subscriptions andnotifying in the second argument, but I don't really like the idea of creating a separate component action (actually, needing to have a concrete component in hand at all) just to be able to perform someHalogenMaction in theEffectmonad and lift the result back to theHalogenM.So
HalogenMshould be enhanced with something like the Haskell'swithRunInIO. I believe it can be done somehow - from my understanding we interpret aHalogenMmonad inAffusing a reference for keeping a state, which somehow resembles theReaderT IOmonads which can easily be unlifted inIO. I can happily try to implement this feature, should you decide its worth having.