Chapter 12. Helpers and patterns

 

This chapter covers

  • Removing duplicate values
  • Pausing a game
  • Junction or client registry
  • Writable remote values
  • Persistence
  • Unique ID generation
  • An FRP-based GUI system

The highly abstracted nature of FRP means solutions can be very general. This opens us up to uncharted oceans of new ways of dealing with programming problems. We (the authors) have only just gotten our feet wet, compared with what the community will discover in time.

This chapter covers some solutions we’ve found to common problems. Some of these examples are complex and will take some unraveling. They’re best treated as reference material for how to solve specific problems, or tests to see how good you are at FRP comprehension. But we hope this chapter will give you a glimpse of what sorts of things are possible.

12.1. Calming: removing duplicate values

We’ll start with a simple one. Sometimes we have a situation where there are unnecessary updates and this adversely affects performance. For example, a particular operation may double the amount of processing, and it may be structured so that this happens several times. The good news is that these cases are generally easy to reason about, but the bad news is that things can get inefficient. We discussed some of these implications in section 7.6. A common way to deal with this is to “calm” a stream or cell by removing values that are repeats of the previous value.

12.2. Pausing a game

12.3. Junction or client registry

12.4. Writable remote values

12.5. Persistence

12.6. Unique ID generation

12.7. An FRP-based GUI system

12.8. Summary