Skip to content
master
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Readme.md

pipes-csv

Constant-space streaming csv parsing with cassava and pipes

build status

Installation

Install with cabal

$ cabal install pipes-csv

Example

{-# LANGUAGE OverloadedStrings #-}

import Pipes.Csv (decode, decodeByName)
import Pipes.ByteString (stdin, ByteString)
import Data.Csv ((.:), FromNamedRecord(..), Record)
import Pipes
import Control.Applicative

data Person = Person String Int
            deriving (Show)

instance FromNamedRecord Person where
  parseNamedRecord p =
    Person <$> p .: "name"
           <*> p .: "age"

persons :: Monad m
        => Producer ByteString m ()
        -> Producer (Either String Person) m ()
persons = decodeByName

main = runEffect $ for (persons stdin) (lift . print)

License

MIT

About

Streaming csv parser using cassava and pipes

Resources

License

Packages

No packages published
You can’t perform that action at this time.