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

Rejects this perfectly valid lens: (value "v" . del /a/ "a")|(value "w" . del /b/ "b") #686

Open
safinaskar opened this issue Jul 29, 2020 · 2 comments

Comments

@safinaskar
Copy link
Contributor

Consider this file a.aug:

module A =
let lns = (value "v" . del /a/ "a")|(value "w" . del /b/ "b")

I think this lens is perfectly valid. It is bijective. But augparse rejects it with the message:

Syntax error in lens definition
/tmp/a.aug:2.0-.61:Failed to compile lns
/tmp/a.aug:2.10-.61:exception: overlapping lenses in tree union.put
    Example matched by both: 
    First lens: /tmp/a.aug:2.10-.34:
    Second lens: /tmp/a.aug:2.31-.60:

Also, please note that line Example matched by both: doesn't show any example, this is strange.
I use version of augeas included in debian sid, i. e. 1.12.0. My system is debian sid amd64

@raphink
Copy link
Member

raphink commented Jul 29, 2020

I don't know why exactly, but this type of constructs require two separate subtrees:

module A =                                                                          
let lns = [value "v" . del /a/ "a" ]| [value "w" . del /b/ "b"]    

@lutter
Copy link
Member

lutter commented Sep 3, 2020

I am not sure what exactly is going wrong there, but the put test below outputs a, not b, when I run it through augparse --notypecheck so something's up:

module A =
let v = (value "v" . del /a/ "a")|(value "w" . del /b/ "b")
let lns = [label "x" . v]

test lns get "a" = ?
test lns get "b" = ?
test lns put "a" after set "/x" "b" = ?

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

No branches or pull requests

3 participants