Skip to content

nasty edge cases with prefix and unprefix #122

@penelopeysm

Description

@penelopeysm
julia> vnp = prefix(@varname(p), @varname(s[1].a))
s[1].a.p

julia> subsumes(@varname(s[1].a), vnp)
false

julia> vnp == @varname(s[1].a.p)
false

This arises because of the associativity of ComposedFunction -- for example in s[1].a.p the lens can be either ComposedFunction(ComposedFunction(.p, .a), .[1])) or it could be ComposedFunction(.p, ComposedFunction(.a, .[1])) (full functions not shown for simplicity).

There are two ways to handle this. One is to carefully disambiguate all cases with lots of if/else or multiple dispatch methods. The other is to enforce normalisation such that ComposedFunction can only have ComposedFunction as its outer optic (for example) and not as its inner optic. That would require us to either write our own ComposedFunction or upstream it.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions