From fd4fc4ce9ad45a25ca3e77a434306aa2476161bb Mon Sep 17 00:00:00 2001 From: Federico Igne Date: Fri, 12 Jan 2024 14:12:57 +0100 Subject: feat(zipper): add function to map on cursor focus with default --- lib/zipper.mli | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/zipper.mli') diff --git a/lib/zipper.mli b/lib/zipper.mli index beeb181..e25d57b 100644 --- a/lib/zipper.mli +++ b/lib/zipper.mli @@ -198,6 +198,10 @@ val map_after : ('a -> 'a) -> 'a zipper -> 'a zipper val map_focus : ('a -> 'a) -> 'a zipper -> 'a zipper (** Map a function over the element focused by the cursor, if any. *) +val map_focus_or : default:'a -> ('a -> 'a) -> 'a zipper -> 'a zipper +(** Map a function over the element focused by the cursor. Push + [default] if no element is focused. *) + val map : ('a -> 'a) -> 'a zipper -> 'a zipper (** Map a function over all elements of a zipper. *) -- cgit v1.2.3