reflex-frp / reflex

Interactive programs without callbacks or side-effects. Functional Reactive Programming (FRP) uses composable events and time-varying values to describe interactive systems as pure functions. Just like other pure functional code, functional reactive code is easier to get right on the first try, maintain, and reuse.
https://reflex-frp.org
BSD 3-Clause "New" or "Revised" License
1.07k stars 149 forks source link

Should there be a MonadDynamic typeclass? (like MonadIO) #110

Open michaelmesser opened 7 years ago

michaelmesser commented 7 years ago

Should the be a MonadDynamic typeclass? (like MonadIO). This would make working with monad stacks easier.

class MonadDynamic m where
    liftDynamic ::  Dynamic t x -> m t x

Time might make this more difficult.

cgibbard commented 7 years ago

Are you transforming the Dynamic t monad?

michaelmesser commented 7 years ago

@cgibbard Like MaybeT (Dynamic t) or EitherT (Dynamic t)

cgibbard commented 7 years ago

I suppose you can do that. It's something that I hadn't considered so much because the Monad instance for Dynamic is so much less commonly used (at least in my experience) than the Applicative and Functor instances, that I hadn't thought very much about it.

If you're doing a great deal of transforming Dynamic, it would make good sense to have a liftDynamic, but it's just not something that's ever come up for me.

ElvishJerricco commented 7 years ago

MonadBase probably covers this well enough that we don't need to create a new class.