Skip to content
Jesper Sandström edited this page Nov 3, 2020 · 2 revisions

Dif(fuser) lets you declaratively define relationships between immutable data and side effects. It was intended to be used for UI development, but the APIs are general enough to be applied to any domain.

This library contains two main building blocks: Diffuser and Fuser. Diffuser lets you define how data should be translated into side-effects, and Fuser lets you define how side-effects should be transformed back into data. By combining these two, you can effectively wrap a side-effecting domain entirely in a pure context.

A key insight to understanding Diffuser and Fuser is to understand that they both form a language. A Diffuser can be built from the primitive into expression, and Diffusers can be combined using the map and intoAll combinators. The combination of two Diffusers is itself a Diffuser, so you can reason about the combination in the same way you reason about the individual parts. This language can be extended arbitrarily and freely by writing functions which take and return Diffusers. Similarly, a primitive Fuser is created using from and can be combined freely with fromAll and extract.

To get started, read the Diffuser and Fuser guides.

Clone this wiki locally