Skip to content

WIP: Initial implementation of optional lens #1

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

baransu
Copy link

@baransu baransu commented Apr 9, 2019

The basic implementation working for simple cases 🙂

Currently, friendStreetNumber lens compiles but returns an invalid result because we're not accepting enough nested field. With other types, it wouldn't compile.

The optional operator is subject to change but ? is not a valid infix operator and PPX have to be valid Reason if we want to use the AST.

@cem2ran
Copy link
Owner

cem2ran commented Aug 2, 2019

Hey @baransu, time flies 😱 Sorry about that!

What do you think about the following two ideas for optional operator:

[%focus person |. department |. address |? street_number]
[%focus person -> department -> address -?> street_number]

|* or -*> would be used for traversal, etc.

[%focus person |. departments |* address |? street_number]
[%focus person -> departments -*> address -?> street_number]

Appears to be valid syntax: https://astexplorer.net/#/gist/8b6189cbc0c84f3678bd45191b93989b/84db4f5e9143e06a62ac675c4c63c515ccf9e1c9

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants