@@ -103,7 +103,15 @@ down = firstChild
104-- | Move the cursor to the last child of the current `Node`.
104-- | Move the cursor to the last child of the current `Node`.
105lastChild :: forall a. Loc a -> Maybe (Loc a)
105lastChild :: forall a. Loc a -> Maybe (Loc a)
106−lastChild p@(Loc r) = last <$> down p
106+lastChild n =
107+ case reverse (children n) of
110+ Just $ Loc { node: c
113+ , parents: n : (parents n)
108-- | Move the cursor to a specific sibling by it's index.
116-- | Move the cursor to a specific sibling by it's index.
109siblingAt :: forall a. Int -> Loc a -> Maybe (Loc a)
117siblingAt :: forall a. Int -> Loc a -> Maybe (Loc a)