These are chat archives for ramda/ramda
||and that tells you if a node needs to change.
data Tree val ann = Leaf ann val | Branch ann (Tree val ann) (Tree val ann)
Functorand stuff to operate over.
And if you have a lens to the element you want to modify:
foo :: Lens (Tree val ann) (Tree val ann)
and function for modifying it:
updateFoo :: Tree val ann -> Tree val ann
Then you can first reset all annotations to
unchanged :: Tree val ann -> Tree val Bool unchanged tree = False <$ tree
make your change:
modifyFoo :: Tree val Bool -> Tree val Bool modifyFoo = over foo ((True <$) . updateFoo)
and find the different ones:
diffs :: Tree val Bool -> Tree val Bool diffs = extend (getAny . foldMap Any)
Just throw it all together with those three functions.
Extendinstance for it to find the differences.