git @ Cat's Eye Technologies Dipple / master haskell / SplitLines.hs
master

Tree @master (Download .tar.gz)

SplitLines.hs @masterraw · history · blame

module SplitLines where

-- SPDX-FileCopyrightText: Chris Pressey, the original author of this work, has dedicated it to the public domain.
-- For more information, please refer to <https://unlicense.org/>
-- SPDX-License-Identifier: Unlicense

splitLines :: String -> String -> [String]
splitLines [] line = [reverse line]
splitLines ('\n':rest) line = [reverse line] ++ (splitLines rest [])
splitLines (char:rest) line = splitLines rest (char:line)