{"comment":{"url":"https://api.github.com/repos/swalker2m/ocs/comments/9492644","html_url":"https://github.com/swalker2m/ocs/commit/afa426c199809c8924f9c9da9aa8f5effa3cfde7#commitcomment-9492644","id":9492644,"user":{"login":"tpolecat","id":1200131,"avatar_url":"https://avatars.githubusercontent.com/u/1200131?v=3","gravatar_id":"","url":"https://api.github.com/users/tpolecat","html_url":"https://github.com/tpolecat","followers_url":"https://api.github.com/users/tpolecat/followers","following_url":"https://api.github.com/users/tpolecat/following{/other_user}","gists_url":"https://api.github.com/users/tpolecat/gists{/gist_id}","starred_url":"https://api.github.com/users/tpolecat/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/tpolecat/subscriptions","organizations_url":"https://api.github.com/users/tpolecat/orgs","repos_url":"https://api.github.com/users/tpolecat/repos","events_url":"https://api.github.com/users/tpolecat/events{/privacy}","received_events_url":"https://api.github.com/users/tpolecat/received_events","type":"User","site_admin":false},"position":42,"line":42,"path":"bundle/edu.gemini.sp.vcs/src/main/scala/edu/gemini/sp/vcs/diff/MergeNode.scala","commit_id":"afa426c199809c8924f9c9da9aa8f5effa3cfde7","created_at":"2015-01-29T06:07:47Z","updated_at":"2015-01-29T06:07:47Z","body":"I think you may be able to use `scalaz.Tree` here, which gives you `foldRight` and `loc` (the zipper) for free.\r\n\r\n```scala\r\n// given a root MergeNode, something like this gives you a Tree[MergeNode]\r\nTree.unfoldTree(root) {\r\n  case n @ ModifiedNode(_, children) => (n, () => children.toStream)\r\n  case n @ UnmodifiedNode(_)         => (m, () => Stream.empty)\r\n}\r\n```\r\n"}}