Repository navigation
[1.0.0] - 2026-11-30
This release changes how errors are reported. Code written against 0.1.x that
matches on {:error, reason} tuples needs to be updated.
Breaking changes
- Navigation, editing and query functions now raise
ExZipper.Errorinstead
of returning{:error, reason}tuples. The error's:reasonfield holds the
same atom the tuple used to (for example:down_from_leaf), and its
:focusfield holds the node the zipper was focused on when it failed. A
pipeline now stops at the step that failed instead of crashing with a
FunctionClauseErrorat the next step. - The
errorandmaybe_zippertypes onExZipper.Zipperhave been removed. remove/1now moves focus to the previous node in a depth-first walk, as
documented. When the removed node's left sibling is a branch, focus moves to
the deepest rightmost node inside it, instead of to the sibling itself.- Once a depth-first walk reaches its end, every function that moves or
changes the zipper raisesExZipper.Errorwith a new reason such as
:down_from_endor:next_of_end. Callroot/1to start again.down/1,up/1,left/1,right/1,leftmost/1,rightmost/1,
lefts/1,rights/1,path/1,insert_left/2,insert_right/2and
remove/1used to crash with aFunctionClauseErroror
UndefinedFunctionError.next/1used to return the same zipper again, andinsert_child/2,
append_child/2,replace/2andedit/2used to change the root while
staying at the end. These now raise too.- The new
map/2also raises when called at the end. node/1,branch?/1,children/1,end?/1,to_list/1,find/2and
find_all/2still work at the end.
- Elixir 1.18 or later is required.
- The license has changed from MIT to the Unlicense.
Added
ExZipper.Error, with a readable message for each failure reason.find/2, which returns a zipper focused on the first node matching a
function, ornilif nothing matches.find_all/2, which returns a zipper for each matching node.map/2, which replaces every node in a depth-first walk with the result of
calling a function on it.root/1now leaves the end state of a depth-first walk.- The
ExZipper.Treebehaviour, withbranch?/1,children/1and
make_node/2callbacks, for defining a kind of tree in a module. new/2, which returns a zipper for a tree using the callbacks of a module
that implementsExZipper.Tree.- An
Inspectimplementation forExZipper.Zipperthat shows the focused
node, with...marking whether there is more of the tree before or after
it, instead of the raw struct with its stored functions and crumbs.
Fixed
- Typespecs referred to a
Zippermodule that did not exist. - The docs for
rights/1andrightmost/1described the wrong thing.
Changed
- All functions are documented on
ExZipper.Zipper, including the
navigation, editing and traversal functions that were previously documented
only on internal modules.