Local edits#2
Open
byorgey wants to merge 10 commits into
Open
Conversation
However, UpMod stuff isn't working as expected. Not yet sure whether there is a bug in the code or my expectations.
cchalmers
reviewed
Jun 1, 2019
Owner
cchalmers
left a comment
There was a problem hiding this comment.
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 | |||
Owner
There was a problem hiding this comment.
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 |
Owner
There was a problem hiding this comment.
I think you want the lower case version here so it rebuilds the name map properly.
Suggested change
| Down ls d' t -> Down ls d' <$> go t | |
| Down _ d' t -> down d' <$> go t |
| Concat i ts -> Concat i <$> traverse go ts | ||
| {-# INLINE leafs #-} | ||
|
|
||
| releaf |
Owner
There was a problem hiding this comment.
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.
Suggested change
| 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) |
Owner
There was a problem hiding this comment.
Suggested change
| 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 |
Owner
There was a problem hiding this comment.
Suggested change
| Down ls d' t -> Down ls d' <$> go (d <> d') t | |
| Down _ d' t -> down d' <$> go (d <> d') t |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Downnodes 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.