When all the nails are trees, the hammer you need probably looks like a chainsaw
summary
Claim: using a Rose Tree gives listlike operators on recursive data so you stop hand-rolling traversal for JSON J schemas and AST-like problems. Implementation detail: an alpha-level Scala port (published to Maven Central yesterday) provides map filter collect foldLeft foldRight and cats Traverse so errors and IO accumulate into Either or effectful trees. Practical notes: traversal guarantees foldLeft guarantees parents before children and foldRight the opposite, no flatMap is provided and API is unstable.
AI-written summary · about
chapters (21)
- 0:00Trees and chainsaws intro
- 1:30How I became tree expert
- 2:36Tree traversal and recursion
- 4:24Map and filter for trees
- 5:31Rose trees and benefits
- 6:58What is a rose tree
- 8:03Chainsaw library intro
- 8:45List to tree operators
- 9:50Filtering trees pitfalls
- 10:56Collecting tree values
- 11:37Folding trees left-right
- 13:25Folding trees right-left
- 13:45Traversing trees with effects
- 15:12Conclusion and future ops
- 17:22Q&A: Fold left vs fold right
- 18:50Q&A: Rose vs binary trees
- 19:35Q&A: Rose tree labels
- 21:03Q&A: Type classes in production
- 22:26Q&A: General tree library plans
- 22:47Q&A: Type class instances
- 23:30Q&A: Pre-order vs depth-first
related talks
32mEditing Trees with Zippers
33mJourney to the Heart of the For-Yield
01h 44mPractical Observable Sharing
01h 35mRecursion Schemes, Algebras, Finally Tagless, Data Types
41mUsing GADTs to create a “Full Stack”, Runtime Gen. Scaffolding Lib in Scala
12mThey're functional! They're efficient!!
01h 03mRefactoring Recursion
07mThe Forest for the (Abstract Syntax) Trees
