Over the past n days, I’ve been working on fantasy-land branch of hyrule based on two major changes:
- A redefinition of the
Behavior atype to narrow its scope: https://dev.to/mikesol/a-new-definition-of-behavior-2076 - Changing
Event ato be hot-only: https://dev.to/mikesol/events-are-best-served-hot-33hc. Most significantly, this means thatEventno longer has anApplicativeinstance.
I’ve so far made accompanying branches for bolson and deku and the results are quite nice: https://github.com/mikesol/purescript-deku/blob/fantasy-land/test/Test/Main.purs.
- There are less ways to do things, which means that patterns are more predictable.
- It’s impossible to introduce arbitrary side effects via
useEffect, which makes tracing effects back to their triggers easier. - There are more overloaded functions, so it’s just
textandclick, no more ietext_andclick_.
I’m currently in the middle of migrating the Deku docs. It’s a large project, and I’m noticing that the size of the framework has shrunk by around 20% and entire sections can now be deleted. For example, you can’t just sneak in random numbers anymore using useEffect, so you wind up using classics like Behavior and Free to accomplish the same thing. One really nice result is that the backend-optimizer winds up consolidating all of the side effects in one place if you inline enough, which is a prerequisite in my “Grand Plan” to write a WebGPU framework that straddles the GPU and CPU using just Event and Behavior.
Hot-only events is a major breaking change to hyrule that requires big rewrites if side effects are spread out over lots of cold events. If you’re a hyrule user and you use pure or any other cold event constructors, please respond here or on Discord & we can discuss more. If I get mostly positive sentiment (or if no one cares), my goal is to merge this and a few other outstanding PRs next week.