[go: nahoru, domu]

Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Composing Getter & Optional returns lists #4

Closed
kenbot opened this issue Jan 24, 2017 · 1 comment
Closed

Composing Getter & Optional returns lists #4

kenbot opened this issue Jan 24, 2017 · 1 comment
Labels
Milestone

Comments

@kenbot
Copy link
Owner
kenbot commented Jan 24, 2017

get"$myObj.$lens.$optional" returns an Option, but get"$myObj.$getter.$optional" returns a List. This is because no "Fold1" exists, and a "Fold" is performed instead. This is surprising behaviour.

We can simulate the expected behaviour by tracking Folds that definitely only have 0-1 elements, and generating a .headOption on the end afterwards.

Something like:

case class Fold(notMulti: Boolean) extends OpticType

See optics-dev/Monocle#484

@kenbot kenbot added this to the 1.0 milestone Jan 24, 2017
@kenbot kenbot added the bug label Jan 24, 2017
@kenbot
Copy link
Owner Author
kenbot commented Feb 15, 2017

"Fold1" added to OpticTypes, with appropriate composition rules.

@kenbot kenbot closed this as completed Feb 15, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant