Skip to content

Instantly share code, notes, and snippets.

@cgrand
Created January 22, 2014 05:31
Show Gist options
  • Save cgrand/8553906 to your computer and use it in GitHub Desktop.
Save cgrand/8553906 to your computer and use it in GitHub Desktop.

Some additional design thoughts about Enliven in reaction to https://gist.github.com/ckirkendall/8532519

Lenses, Segments and Paths

Segments are lenses. fetch and putback generalize get and assoc. Some segments may be fetch-only (and thus broken lenses).

Paths are lists of segments. If all segments are lenses then a path can be considered a lens too but fetch-in and putback-in need to be used instead.

Note that paths/canonical hoists segments into paths.

Paths are used in two different contexts:

  • for html traversal and update ** not directly provided by the user but returned by the selectors ** these paths MUST be lenses
  • for data (state) scoping ** these paths are not required to be lenses ** unless the scoped transform is an event-handler.

scope and at are similar: scope scopes the state of a transform, at scopes the nodes of a transform.

Transforms

Event handlers and components are transforms too.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment