3 ms·
> I have yet to see a FRP library that allows you to just use a component without introducing boilerplate. I'm the author of https://github.com/calmm-js https:
by polytypic 9y ago
> I have yet to see a FRP library that allows you to just use a component without introducing boilerplate.
I'm the author of https://github.com/calmm-js https://github.com/calmm-js.
I wouldn't necessarily describe it as (pure) FRP, but the combination of techniques used in Calmm pretty much eliminates all boilerplate: in the limit, a truly useful component can be just a single function with a body of a single line of code. Using that component then is just a matter of instantiating the component with desired parameters (no boilerplate). The lack of boilerplate makes it practical to eliminate even small scale repetition with local components.
Parameters to components in Calmm can represent read-only (Observable) or read-write (Atom :> Observable) state. RW state can be sliced with lenses and be used as RO state without glue. RO state can be arbitrarily combined to compute desired properties. Thanks to being able to effortlessly slice RW state, components can be easily made independent of the application state as a whole (IOW, a component can be made to take only just the state it needs as parameters) and be made truly reusable.
Calmm also makes it simple and easy to create both stateless components (consider #1) and components that can optionally use local state so that the user of the component can actually choose whether the component uses local state or a slice of global state.
Calmm also primarily guides you to use stateless, time independent, continuous, observable properties (combine) rather than streams of discrete events (merge + scan) (see #2) which actually introduce undesirable local state and force you to consider timing dependencies again.
#1) https://awelonblue.wordpress.com/2012/10/21/local-state-is-poison/ https://awelonblue.wordpress.com/2012/10/21/local-state-is-p...
#2) https://awelonblue.wordpress.com/2012/07/01/why-not-events/ https://awelonblue.wordpress.com/2012/07/01/why-not-events/