git.iko.soy/rowtype-yoga/purescript-yoga-tree
on master help sign in
Fix bug in `first`
c9cfe82Jordan Martinez
src/Data/Tree/Zipper.purs+2−2
@@ -50,11 +50,11 @@ prev (Loc r) =
50-- -- | Move the cursor to the first sibling.
50-- -- | Move the cursor to the first sibling.
51first :: forall a. Loc a -> Loc a
51first :: forall a. Loc a -> Loc a
52first l@(Loc r) =
52first l@(Loc r) =
53− case r.before of
53+ case reverse r.before of
54 Nil -> l
54 Nil -> l
55 c:cs -> Loc r { node = c
55 c:cs -> Loc r { node = c
56 , before = Nil
56 , before = Nil
57− , after = (reverse cs) <> r.after
57+ , after = cs <> r.after
58 }
58 }
59
59
60-- -- | Move the cursor to the last sibling.
60-- -- | Move the cursor to the last sibling.