p
mergeRight :: SplitArray ~> SplitArray
mergeRight xs =
case uncons xs of
Nothing -> []
Just {head: Text c, tail} -> let (Tuple d lTail) = go tail in Text (c <> d) : mergeRight lTail
Just r -> r.head : mergeRight r.tail
where
go tail = case uncons tail of
Just { head: Delim d', tail: tail' } -> Tuple d' tail'
_ -> Tuple [] tail
