module Data.Text.Zipper.Vector
    ( vecLines
    )
where

import qualified Data.Vector as V

vecLines :: V.Vector Char -> [V.Vector Char]
vecLines :: Vector Char -> [Vector Char]
vecLines Vector Char
v | forall a. Vector a -> Bool
V.null Vector Char
v  = []
           | Bool
otherwise = case forall a. Eq a => a -> Vector a -> Maybe Int
V.elemIndex Char
'\n' Vector Char
v of
               Maybe Int
Nothing -> [Vector Char
v]
               Just Int
i -> let (Vector Char
h, Vector Char
t) = forall a. Int -> Vector a -> (Vector a, Vector a)
V.splitAt Int
i Vector Char
v
                         in Vector Char
h forall a. a -> [a] -> [a]
: Vector Char -> [Vector Char]
vecLines Vector Char
t