> spanLines :: String -> [String] > spanLines "" = [] > spanLines s = let (l, s') = span' (/= '\n') s > in l : case s' of > [] -> [] > (_:s'') -> spanLines s'' > span' p [] = ([],[]) > span' p xs@(x:xs') > | p x = (x:ys, zs) > | otherwise = ([],xs) > where ~(ys,zs) = span' p xs' > main = interact (unlines . spanLines)