Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I think this is the corrected version

    import Control.Monad (forM_)
    import Data.List.Split (splitOn)
    import Data.List (transpose)
    import System.IO

    main :: IO ()
    main = do
      withFile "tel.csv" ReadMode $ \handle -> do 
           contents <- hGetContents handle
           let clines = lines contents
               ccols  = transpose (map (splitOn ",") clines)
           forM_ (ccols !! 3) $ \cell -> do
             putStrLn cell


Good catch—obviously I wrote that freehand :)




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: