Skip to content
This repository has been archived by the owner on Mar 5, 2023. It is now read-only.

Make Property a monad/functor #2

Closed
grmble opened this issue Sep 10, 2017 · 1 comment
Closed

Make Property a monad/functor #2

grmble opened this issue Sep 10, 2017 · 1 comment
Labels

Comments

@grmble
Copy link
Owner

grmble commented Sep 10, 2017

If Property were a monad, event handling code would be simpler and more powerful.

EventDecoder might become unnecessary.

@grmble grmble changed the title Make Property a monad Make Property a monad/functor Sep 11, 2017
@grmble
Copy link
Owner Author

grmble commented Sep 11, 2017

This would make the code simpler, but it would be a performance problem. Ideally, the decoding functions in a VirtualDom on-Node should be comparable. That is a hard problem, so object identity is compared. If the functions remain the same javascript objects between render passes, expensive DOM updates can be skipped. Functions are only ever the same object if they are compiled down to a module-level function (not a curried function!)

Composing Properties after their creation would defeat this.

The path forward is to make EventDecoder a functor/monad, this makes it easy to define a module-level helper function that is used to create the event handling Property.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant