-
Notifications
You must be signed in to change notification settings - Fork 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
Local edits #2
base: master
Are you sure you want to change the base?
Local edits #2
Conversation
However, UpMod stuff isn't working as expected. Not yet sure whether there is a bug in the code or my expectations.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just a quick pass. I haven't tested them out yet, will try to soon.
@@ -457,24 +461,24 @@ instance Monoid d => TraversableWithIndex d (NE i d u m a) where | |||
pushDown :: (Action d m, Action d a, Monoid' d) => NE i d u m a l -> NE i d u m a l | |||
pushDown = go where |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this function make sense anymore? Down annotations should now be static for traversals to work?
-- {-# INLINE leafs #-} | ||
Label i EmptyDUAL -> pure (Label i EmptyDUAL) | ||
Label i (NE t) -> Label i . NE <$> go t | ||
Down ls d' t -> Down ls d' <$> go t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you want the lower case version here so it rebuilds the name map properly.
Down ls d' t -> Down ls d' <$> go t | |
Down _ d' t -> down d' <$> go t |
Down ls d' t -> Down ls d' <$> go t | ||
Annot i a t -> Annot i a <$> go t | ||
Concat i ts -> Concat i <$> traverse go ts | ||
{-# INLINE leafs #-} | ||
|
||
releaf |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm not sure this function is that useful anymore but if we do want to keep it the comment should be clearer that the old downs are still there.
releaf | |
-- | Rebuild the tree by replacing each leaf given the old leaf and the up and down annotations applied to it. Note that the old down annotations remain higher up the tree. | |
releaf |
n -> f d <&> \d' -> down d' (NE n) | ||
Label i EmptyDUAL -> Label i EmptyDUAL | ||
Label i (NE t) -> Label i . NE $ go d t | ||
Down ls d' t -> Down ls d' (go (d <> d') t) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Down ls d' t -> Down ls d' (go (d <> d') t) | |
Down _ d' t -> down d' (go (d <> d') t) |
-- {-# INLINE matchingU #-} | ||
Label i EmptyDUAL -> pure (Label i EmptyDUAL) | ||
Label i (NE t) -> Label i . NE <$> go d t | ||
Down ls d' t -> Down ls d' <$> go (d <> d') t |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Down ls d' t -> Down ls d' <$> go (d <> d') t | |
Down _ d' t -> down d' <$> go (d <> d') t |
Down
nodes now count as annotations that must be counted through when following a path. A lens onto a specific node sees only the subtree rooted there, without accumulated down annotations being applied first. This makes edits more "local" and (arguably) more intuitive.