:: ([a] -> (b, [a])) -> [a] -> [b] package:extra

Apply some operation repeatedly, producing an element of output and the remainder of the list. When the empty list is reached it is returned, so the operation is never applied to the empty input. That fact is encoded in the type system with repeatedlyNE
\xs -> repeatedly (splitAt 3) xs  == chunksOf 3 xs
\xs -> repeatedly word1 (trim xs) == words xs
\xs -> repeatedly line1 xs == lines xs