Created
October 20, 2012 11:36
-
-
Save igrep/3923075 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import qualified Data.Text.IO as TIO (hGetLine) | |
| import Data.Text (Text) | |
| import qualified Data.Text as T | |
| import System.IO | |
| import Control.Applicative ((<$>), (<*>), pure) | |
| hGetLines :: Handle -> IO [Text] | |
| hGetLines h = do | |
| eof <- hIsEOF h | |
| if eof | |
| then pure [] | |
| else (:) <$> TIO.hGetLine h <*> hGetLines h | |
| main :: IO () | |
| main = | |
| hGetLines stdin >>= mapM_ (putStrLn . show . T.length) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment