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

What is the meaning of Adjustable? #418

Open parenthetical opened 4 years ago

parenthetical commented 4 years ago

It looks like something I could make use of but I'm having a hard time wrapping my head around it.

Would it be something like this for the pure implementation?

instance ( Enum t, HasTrie t, Ord t, t' ~ Pure t
         ) => Adjustable (Pure t) ((->) t) where
  runWithReplace :: (t -> a) -> Event t' (t -> b) -> t -> (a, Event t' b)
  runWithReplace ma (Event e) from = (ma from, Event (fmap ($ from) . e))