Skip to content

Conversation

@blacktaxi
Copy link
Member

This tracks #17

The issue is that Lens.withDefault with unexpectedly use an undefined value in place of a value passed into a Lens.set when it is equal to the default value provided.

It makes sense, as it is more lawful (in lens laws terms) to remove a value when set to default. Although technically, the current implementation is not lawful either, because { a: 5, b: undefined } is not strictly equal to { a: 5 }.

I see these options:

  1. Change Lens.withDefault to actually modify the data structure even when set to a default value.
  2. Leave Lens.withDefault as it is and implement a separate lens with this new behavior.

Bonus option: if we decide to keep current Lens.withDefault, fix it to be truly lawful.

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

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants