Skip to content

Instantly share code, notes, and snippets.

@MiyamonY
Created February 27, 2015 09:49
Show Gist options
  • Save MiyamonY/9a8ea7eba421d3b75d34 to your computer and use it in GitHub Desktop.
Save MiyamonY/9a8ea7eba421d3b75d34 to your computer and use it in GitHub Desktop.
main :: IO ()
main = do
contents <- getContents
putStr $ shortLinesOnly contents
shortLinesOnly :: String -> String
shortLinesOnly = unlines . filter (\ line -> length line < 10) . lines
-- lines :: String -> [String]
-- lines "aaa\nbbb\nccc" => ["aaa","bbb","ccc"]
-- unlines :: [String] -> String
-- unlines ["aaa", "bbb", "ccc"] => "aaa\nbbb\nccc\n"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment