Skip to content

Test lens-compose / compose relationship #271

@jackfirth

Description

@jackfirth

lens-compose should compose lenses in the same order as compose (it does currently, but it should be documented in tests that this order is preferred). This is to preserve the general assumption that lenses work like functions, but with the added "inverting" behavior for bidirectional programming. This assumption means the following should all be true:

  • When only using lens-view, lenses should operate like the getter functions they mimic. Thus, (lens-view (lens-compose l ...) target) should be equivalent to ((compose (lens-view l _) ...) target).
  • Applicable lenses behave like getters literally, so ((lens-compose l ...) target) should be equivalent to ((compose l ...) target) when using applicable lenses.
  • lens-thrush should invert direction just like thrush inverts function composition direction.

This issue is more to document why I made this ordering decision, as I recently noticed that Ramda's lensCompose uses the "wrong order".

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions