You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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".
The text was updated successfully, but these errors were encountered:
Update: Ramda uses this order because Haskell does - Haskell does because it uses van Laarhoven lenses, which are functions and lens composition is the same as function composition. The details of the Laarhoven representation bring about the "composition inversion" behavior. I consider this an unfortunate consequence of the implementation, and Racket lenses are bound by no such implementation restrictions.
lens-compose
should compose lenses in the same order ascompose
(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: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)
.((lens-compose l ...) target)
should be equivalent to((compose l ...) target)
when using applicable lenses.lens-thrush
should invert direction just likethrush
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".The text was updated successfully, but these errors were encountered: