@@ -229,6 +229,39 @@ delete l@(Loc r) =
229 , parents: parents c
229 , parents: parents c
234+-- | Search for the first occurence of the value `a` downwards and to the right.
235+findDown :: forall a. Eq a => a -> Loc a -> Maybe (Loc a)
236+findDown a l@(Loc r) =
241+ Just n -> findDown a n
244+ Just n' -> findDown a n'
247+-- | Search for the first occurence of the value `a` upwards and to the left.
248+findUp :: forall a. Eq a => a -> Loc a -> Maybe (Loc a)
254+ Just n -> findUp a n
257+ Just n' -> findUp a n'
260+-- | Search for the first occurence of the value `a` starting from the root of
262+findFromRoot :: forall a. Eq a => a -> Loc a -> Maybe (Loc a)
263+findFromRoot a = (findDown a) <<< root
232-- Setters and Getters
265-- Setters and Getters
233node :: forall a. Loc a -> Tree a
266node :: forall a. Loc a -> Tree a
234node (Loc r) = r.node
267node (Loc r) = r.node