3 ms·
Others have recommended good books, but here's a glimpse just immediately. import Control.Monad (forM_) import Data.List.Split (splitOn) import Dat
by tel 13y ago
Others have recommended good books, but here's a glimpse just immediately.
import Control.Monad (forM_)
import Data.List.Split (splitOn)
import Data.List (transpose)
import System.IO
main :: IO ()
main = do
withFile "file.file" ReadMode $ \handle ->
contents <- hGetContents handle
let clines = lines contents
ccols = transpose (map (splitOn ",") lines)
forM_ (ccols !! 3) $ \cell -> do
putStrLn cell
Then take a look at the following packages
http://hackage.haskell.org/package/split
http://hackage.haskell.org/package/mysql-simple
http://hackage.haskell.org/package/sqlite-simple
- platz 13y agoI 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
- tel 13y agoGood catch—obviously I wrote that freehand :)