/usr/share/doc/libghc-csv-conduit-doc/html/Data-CSV-Conduit.html is in libghc-csv-conduit-doc 0.6.6-5build1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Data.CSV.Conduit</title><link href="ocean.css" rel="stylesheet" type="text/css" title="Ocean" /><script src="haddock-util.js" type="text/javascript"></script><script type="text/javascript">//<![CDATA[
window.onload = function () {pageLoad();setSynopsis("mini_Data-CSV-Conduit.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="src/Data-CSV-Conduit.html">Source</a></li><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">csv-conduit-0.6.6: A flexible, fast, conduit-based CSV parser library for Haskell.</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Data.CSV.Conduit</p></div><div id="table-of-contents"><p class="caption">Contents</p><ul><li><a href="#g:1">Main Interface</a></li><li><a href="#g:2">Re-exported For Convenience</a></li></ul></div><div id="synopsis"><p id="control.syn" class="caption expander" onclick="toggleSection('syn')">Synopsis</p><ul id="section.syn" class="hide" onclick="toggleSection('syn')"><li class="src short"><a href="#v:decodeCSV">decodeCSV</a> :: (<a href="file:///usr/share/doc/libghc-vector-doc/html/Data-Vector-Generic.html#t:Vector">Vector</a> v a, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s a) => <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> s -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Exception-Base.html#t:SomeException">SomeException</a> (v a)</li><li class="src short"><a href="#v:readCSVFile">readCSVFile</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> a) => <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a> -> m (<a href="file:///usr/share/doc/libghc-vector-doc/html/Data-Vector.html#t:Vector">Vector</a> a)</li><li class="src short"><a href="#v:writeCSVFile">writeCSVFile</a> :: <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> a => <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IOMode">IOMode</a> -> [a] -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> ()</li><li class="src short"><a href="#v:transformCSV">transformCSV</a> :: (<a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:MonadThrow">MonadThrow</a> m, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s a, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s' b) => <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Source">Source</a> m s -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> a m b -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Sink">Sink</a> s' m () -> m ()</li><li class="src short"><a href="#v:transformCSV-39-">transformCSV'</a> :: (<a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:MonadThrow">MonadThrow</a> m, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s a, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s' b) => <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Source">Source</a> m s -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> a m b -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Sink">Sink</a> s' m () -> m ()</li><li class="src short"><a href="#v:mapCSVFile">mapCSVFile</a> :: (<a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:MonadResource">MonadResource</a> m, <a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:MonadThrow">MonadThrow</a> m, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> a, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> b) => <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> (a -> [b]) -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a> -> m ()</li><li class="src short"><a href="#v:writeHeaders">writeHeaders</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s (<a href="Data-CSV-Conduit.html#t:Row">Row</a> r), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:IsString">IsString</a> s) => <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> (<a href="Data-CSV-Conduit.html#t:MapRow">MapRow</a> r) m s</li><li class="src short"><span class="keyword">class</span> <a href="#t:CSV">CSV</a> s r <span class="keyword">where</span><ul class="subs"><li><a href="#v:rowToStr">rowToStr</a> :: <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> r -> s</li><li><a href="#v:intoCSV">intoCSV</a> :: <a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:MonadThrow">MonadThrow</a> m => <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> s m r</li><li><a href="#v:fromCSV">fromCSV</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> r m s</li></ul></li><li class="src short"><span class="keyword">data</span> <a href="#t:CSVSettings">CSVSettings</a> = <a href="#v:CSVSettings">CSVSettings</a> {<ul class="subs"><li><a href="#v:csvSep">csvSep</a> :: !<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></li><li><a href="#v:csvQuoteChar">csvQuoteChar</a> :: !(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>)</li></ul>}</li><li class="src short"><a href="#v:defCSVSettings">defCSVSettings</a> :: <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a></li><li class="src short"><span class="keyword">type</span> <a href="#t:MapRow">MapRow</a> a = <a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-Map-Lazy.html#t:Map">Map</a> a a</li><li class="src short"><span class="keyword">type</span> <a href="#t:Row">Row</a> a = [a]</li><li class="src short"><a href="#v:runResourceT">runResourceT</a> :: <a href="file:///usr/share/doc/libghc-monad-control-doc/html/Control-Monad-Trans-Control.html#t:MonadBaseControl">MonadBaseControl</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> m => <a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:ResourceT">ResourceT</a> m a -> m a</li></ul></div><div id="interface"><h1 id="g:1">Main Interface</h1><div class="top"><p class="src"><a name="v:decodeCSV" class="def">decodeCSV</a> :: (<a href="file:///usr/share/doc/libghc-vector-doc/html/Data-Vector-Generic.html#t:Vector">Vector</a> v a, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s a) => <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> s -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Either.html#t:Either">Either</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Exception-Base.html#t:SomeException">SomeException</a> (v a) <a href="src/Data-CSV-Conduit.html#decodeCSV" class="link">Source</a></p><div class="doc"><p>A simple way to decode a CSV string. Don't be alarmed by the
polymorphic nature of the signature. <code>s</code> is the type for the string
and <code>v</code> is a kind of <code>Vector</code> here.</p><p>For example for <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></code>:</p><pre class="screen"><code class="prompt">>>> </code><strong class="userinput"><code>s <- LB.readFile "my.csv"
</code></strong><code class="prompt">>>> </code><strong class="userinput"><code>decodeCSV 'def' s :: Vector (Vector ByteString)
</code></strong></pre><p>will just work.</p></div></div><div class="top"><p class="src"><a name="v:readCSVFile" class="def">readCSVFile</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/transformers-0.4.2.0/Control-Monad-IO-Class.html#t:MonadIO">MonadIO</a> m, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> a) => <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a> -> m (<a href="file:///usr/share/doc/libghc-vector-doc/html/Data-Vector.html#t:Vector">Vector</a> a) <a href="src/Data-CSV-Conduit.html#readCSVFile" class="link">Source</a></p><div class="doc"><p>Read the entire contents of a CSV file into memory.
readCSVFile
:: (GV.Vector v a, CSV ByteString a)
=> CSVSettings
-- ^ Settings to use in deciphering stream
-> FilePath
-- ^ Input file
-> IO (v a)</p></div></div><div class="top"><p class="src"><a name="v:writeCSVFile" class="def">writeCSVFile</a> <a href="src/Data-CSV-Conduit.html#writeCSVFile" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> a</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a></td><td class="doc"><p>CSV Settings</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a></td><td class="doc"><p>Target file</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IOMode">IOMode</a></td><td class="doc"><p>Write vs. append mode</p></td></tr><tr><td class="src">-> [a]</td><td class="doc"><p>List of rows</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> ()</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Write CSV data into file. As we use a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></code> sink, you'll
need to get your data into a <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></code> stream type.</p></div></div><div class="top"><p class="src"><a name="v:transformCSV" class="def">transformCSV</a> <a href="src/Data-CSV-Conduit.html#transformCSV" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:MonadThrow">MonadThrow</a> m, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s a, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s' b)</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a></td><td class="doc"><p>Settings to be used for both input and output</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Source">Source</a> m s</td><td class="doc"><p>A raw stream data source. Ex: 'sourceFile inFile'</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> a m b</td><td class="doc"><p>A transforming conduit</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Sink">Sink</a> s' m ()</td><td class="doc"><p>A raw stream data sink. Ex: 'sinkFile outFile'</p></td></tr><tr><td class="src">-> m ()</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Like transformCSV' but uses the same settings for both input and
output.</p></div></div><div class="top"><p class="src"><a name="v:transformCSV-39-" class="def">transformCSV'</a> <a href="src/Data-CSV-Conduit.html#transformCSV%27" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:MonadThrow">MonadThrow</a> m, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s a, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s' b)</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a></td><td class="doc"><p>Settings to be used for input</p></td></tr><tr><td class="src">-> <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a></td><td class="doc"><p>Settings to be used for output</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Source">Source</a> m s</td><td class="doc"><p>A raw stream data source. Ex: 'sourceFile inFile'</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> a m b</td><td class="doc"><p>A transforming conduit</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Sink">Sink</a> s' m ()</td><td class="doc"><p>A raw stream data sink. Ex: 'sinkFile outFile'</p></td></tr><tr><td class="src">-> m ()</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>General purpose CSV transformer. Apply a list-like processing
function from <code><a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#v:List">List</a></code> to the rows of a CSV stream. You
need to provide a stream data source, a transformer and a stream
data sink.</p><p>An easy way to run this function would be <code><a href="Data-CSV-Conduit.html#v:runResourceT">runResourceT</a></code> after
feeding it all the arguments.</p><p>Example - map a function over the rows of a CSV file:</p><pre>transformCSV setIn setOut (sourceFile inFile) (C.map f) (sinkFile outFile)</pre></div></div><div class="top"><p class="src"><a name="v:mapCSVFile" class="def">mapCSVFile</a> <a href="src/Data-CSV-Conduit.html#mapCSVFile" class="link">Source</a></p><div class="subs arguments"><p class="caption">Arguments</p><table><tr><td class="src">:: (<a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:MonadResource">MonadResource</a> m, <a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:MonadThrow">MonadThrow</a> m, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> a, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> b)</td><td class="doc empty"> </td></tr><tr><td class="src">=> <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a></td><td class="doc"><p>Settings to use both for both input and output</p></td></tr><tr><td class="src">-> (a -> [b])</td><td class="doc"><p>A mapping function</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a></td><td class="doc"><p>Input file</p></td></tr><tr><td class="src">-> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:FilePath">FilePath</a></td><td class="doc"><p>Output file</p></td></tr><tr><td class="src">-> m ()</td><td class="doc empty"> </td></tr></table></div><div class="doc"><p>Map over the rows of a CSV file. Provided for convenience for
historical reasons.</p><p>An easy way to run this function would be <code><a href="Data-CSV-Conduit.html#v:runResourceT">runResourceT</a></code> after
feeding it all the arguments.</p></div></div><div class="top"><p class="src"><a name="v:writeHeaders" class="def">writeHeaders</a> :: (<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s (<a href="Data-CSV-Conduit.html#t:Row">Row</a> r), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:IsString">IsString</a> s) => <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> (<a href="Data-CSV-Conduit.html#t:MapRow">MapRow</a> r) m s <a href="src/Data-CSV-Conduit.html#writeHeaders" class="link">Source</a></p><div class="doc"><p>Write headers AND the row into the output stream, once. If you
don't call this while using <code><a href="Data-CSV-Conduit.html#t:MapRow">MapRow</a></code> family of row types, then your
resulting output will NOT have any headers in it.</p><p>Usage: Just chain this using the <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a></code> instance in your pipeline:</p><pre>... =$= writeHeaders settings >> fromCSV settings $$ sinkFile "..."</pre></div></div><div class="top"><p class="src"><span class="keyword">class</span> <a name="t:CSV" class="def">CSV</a> s r <span class="keyword">where</span> <a href="src/Data-CSV-Conduit.html#CSV" class="link">Source</a></p><div class="doc"><p>Represents types <code>r</code> that are CSV-like and can be converted
to/from an underlying stream of type <code>s</code>. There is nothing scary
about the type:</p><p><code>s</code> represents stream types that can be converted to/from CSV rows.
Examples are <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></code>, <code><a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a></code> and <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a></code>.</p><p><code>r</code> represents the target CSV row representations that this library
can work with. Examples are the <code><a href="Data-CSV-Conduit.html#t:Row">Row</a></code> types, the <code>Record</code> type and
the <code><a href="Data-CSV-Conduit.html#t:MapRow">MapRow</a></code> family of types. We can also convert directly to
complex Haskell types using the <code><a href="Data-CSV-Conduit.html#v:Conversion">Conversion</a></code>
module that was borrowed from the cassava package, which was itself
inspired by the aeson package.</p><p>Example #1: Basics Using Convenience API</p><pre>import Data.Conduit
import Data.Conduit.Binary
import Data.Conduit.List as CL
import Data.CSV.Conduit
myProcessor :: Conduit (Row Text) m (Row Text)
myProcessor = CL.map reverse
test = runResourceT $
transformCSV defCSVSettings
(sourceFile "input.csv")
myProcessor
(sinkFile "output.csv")</pre><p>Example #2: Basics Using Conduit API</p><pre>import Data.Conduit
import Data.Conduit.Binary
import Data.CSV.Conduit
myProcessor :: Conduit (MapRow Text) m (MapRow Text)
myProcessor = undefined
test = runResourceT $
sourceFile "test/BigFile.csv" $=
intoCSV defCSVSettings $=
myProcessor $=
(writeHeaders defCSVSettings >> fromCSV defCSVSettings) $$
sinkFile "test/BigFileOut.csv"</pre></div><div class="subs methods"><p class="caption">Methods</p><p class="src"><a name="v:rowToStr" class="def">rowToStr</a> :: <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> r -> s <a href="src/Data-CSV-Conduit.html#rowToStr" class="link">Source</a></p><div class="doc"><p>Convert a CSV row into strict ByteString equivalent.</p></div><p class="src"><a name="v:intoCSV" class="def">intoCSV</a> :: <a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:MonadThrow">MonadThrow</a> m => <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> s m r <a href="src/Data-CSV-Conduit.html#intoCSV" class="link">Source</a></p><div class="doc"><p>Turn a stream of <code>s</code> into a stream of CSV row type. An example
would be parsing a ByteString stream as rows of <code><a href="Data-CSV-Conduit.html#t:MapRow">MapRow</a></code> <code><a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a></code>.</p></div><p class="src"><a name="v:fromCSV" class="def">fromCSV</a> :: <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Control-Monad.html#t:Monad">Monad</a> m => <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> -> <a href="file:///usr/share/doc/libghc-conduit-doc/html/Data-Conduit.html#t:Conduit">Conduit</a> r m s <a href="src/Data-CSV-Conduit.html#fromCSV" class="link">Source</a></p><div class="doc"><p>Turn a stream of CSV row type back into a stream of <code>s</code>. An
example would be rendering a stream of <code><a href="Data-CSV-Conduit.html#t:Row">Row</a></code> <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></code> rows as
<code><a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a></code>.</p></div></div><div class="subs instances"><p id="control.i:CSV" class="caption collapser" onclick="toggleSection('i:CSV')">Instances</p><div id="section.i:CSV" class="show"><table><tr><td class="src clearfix"><span class="inst-left">(<a href="Data-CSV-Conduit-Conversion.html#t:FromNamedRecord">FromNamedRecord</a> a, <a href="Data-CSV-Conduit-Conversion.html#t:ToNamedRecord">ToNamedRecord</a> a, <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s (<a href="Data-CSV-Conduit.html#t:MapRow">MapRow</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a>)) => <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s (<a href="Data-CSV-Conduit-Conversion.html#t:Named">Named</a> a)</span> <a href="src/Data-CSV-Conduit.html#line-242" class="link">Source</a></td><td class="doc"><p>Conversion of stream directly to/from a custom complex haskell
type.</p></td></tr><tr><td class="src clearfix"><span class="inst-left">(<a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s (<a href="Data-CSV-Conduit.html#t:Row">Row</a> s'), <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Ord.html#t:Ord">Ord</a> s', <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:IsString">IsString</a> s) => <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s (<a href="Data-CSV-Conduit.html#t:MapRow">MapRow</a> s')</span> <a href="src/Data-CSV-Conduit.html#line-219" class="link">Source</a></td><td class="doc"><p>Generic <code><a href="Data-CSV-Conduit.html#t:MapRow">MapRow</a></code> instance; any stream type with a <code><a href="Data-CSV-Conduit.html#t:Row">Row</a></code> instance
automatically gets a <code><a href="Data-CSV-Conduit.html#t:MapRow">MapRow</a></code> instance.</p></td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s (<a href="Data-CSV-Conduit.html#t:Row">Row</a> s) => <a href="Data-CSV-Conduit.html#t:CSV">CSV</a> s (<a href="file:///usr/share/doc/libghc-vector-doc/html/Data-Vector.html#t:Vector">Vector</a> s)</span> <a href="src/Data-CSV-Conduit.html#line-193" class="link">Source</a></td><td class="doc"><p>Support for parsing rows in the <code>Vector</code> form.</p></td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Data-CSV-Conduit.html#t:CSV">CSV</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> (<a href="Data-CSV-Conduit.html#t:Row">Row</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a>)</span> <a href="src/Data-CSV-Conduit.html#line-186" class="link">Source</a></td><td class="doc"><p><code><a href="Data-CSV-Conduit.html#t:Row">Row</a></code> instance using <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-String.html#t:String">String</a></code> based on <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></code> stream.
Please note this uses the ByteString operations underneath and has
lots of unnecessary overhead. Included for convenience.</p></td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Data-CSV-Conduit.html#t:CSV">CSV</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> (<a href="Data-CSV-Conduit.html#t:Row">Row</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a>)</span> <a href="src/Data-CSV-Conduit.html#line-143" class="link">Source</a></td><td class="doc"><p><code><a href="Data-CSV-Conduit.html#t:Row">Row</a></code> instance using <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></code></p></td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Data-CSV-Conduit.html#t:CSV">CSV</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a> (<a href="Data-CSV-Conduit.html#t:Row">Row</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a>)</span> <a href="src/Data-CSV-Conduit.html#line-175" class="link">Source</a></td><td class="doc"><p><code><a href="Data-CSV-Conduit.html#t:Row">Row</a></code> instance using <code><a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a></code> based on <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/bytestring-0.10.6.0/Data-ByteString.html#t:ByteString">ByteString</a></code> stream</p></td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="Data-CSV-Conduit.html#t:CSV">CSV</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a> (<a href="Data-CSV-Conduit.html#t:Row">Row</a> <a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a>)</span> <a href="src/Data-CSV-Conduit.html#line-159" class="link">Source</a></td><td class="doc"><p><code><a href="Data-CSV-Conduit.html#t:Row">Row</a></code> instance using <code><a href="file:///usr/share/doc/libghc-text-doc/html/Data-Text.html#t:Text">Text</a></code></p></td></tr></table></div></div></div><div class="top"><p class="src"><span class="keyword">data</span> <a name="t:CSVSettings" class="def">CSVSettings</a> <a href="src/Data-CSV-Conduit-Types.html#CSVSettings" class="link">Source</a></p><div class="doc"><p>Settings for a CSV file. This library is intended to be flexible
and offer a way to process the majority of text data files out
there.</p></div><div class="subs constructors"><p class="caption">Constructors</p><table><tr><td class="src"><a name="v:CSVSettings" class="def">CSVSettings</a></td><td class="doc empty"> </td></tr><tr><td colspan="2"><div class="subs fields"><p class="caption">Fields</p><dl><dt class="src"><a name="v:csvSep" class="def">csvSep</a> :: !<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a></dt><dd class="doc"><p>Separator character to be used in between fields</p></dd><dt class="src"><a name="v:csvQuoteChar" class="def">csvQuoteChar</a> :: !(<a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#t:Maybe">Maybe</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Char.html#t:Char">Char</a>)</dt><dd class="doc"><p>Quote character that may sometimes be present around fields.
If <code><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Maybe.html#v:Nothing">Nothing</a></code> is given, the library will never expect quotation
even if it is present.</p></dd></dl><div class="clear"></div></div></td></tr></table></div><div class="subs instances"><p id="control.i:CSVSettings" class="caption collapser" onclick="toggleSection('i:CSVSettings')">Instances</p><div id="section.i:CSVSettings" class="show"><table><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Data-Eq.html#t:Eq">Eq</a> <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a></span> <a href="src/Data-CSV-Conduit-Types.html#line-25" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Read.html#t:Read">Read</a> <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a></span> <a href="src/Data-CSV-Conduit-Types.html#line-25" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/Text-Show.html#t:Show">Show</a> <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a></span> <a href="src/Data-CSV-Conduit-Types.html#line-25" class="link">Source</a></td><td class="doc empty"> </td></tr><tr><td class="src clearfix"><span class="inst-left"><a href="file:///usr/share/doc/libghc-data-default-doc/html/Data-Default.html#t:Default">Default</a> <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a></span> <a href="src/Data-CSV-Conduit-Types.html#line-42" class="link">Source</a></td><td class="doc empty"> </td></tr></table></div></div></div><div class="top"><p class="src"><a name="v:defCSVSettings" class="def">defCSVSettings</a> :: <a href="Data-CSV-Conduit.html#t:CSVSettings">CSVSettings</a> <a href="src/Data-CSV-Conduit-Types.html#defCSVSettings" class="link">Source</a></p><div class="doc"><p>Default settings for a CSV file.</p><pre>csvSep = ','
csvQuoteChar = Just '"'</pre></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:MapRow" class="def">MapRow</a> a = <a href="file:///usr/share/doc/ghc-doc/html/libraries/containers-0.5.6.2/Data-Map-Lazy.html#t:Map">Map</a> a a <a href="src/Data-CSV-Conduit-Types.html#MapRow" class="link">Source</a></p><div class="doc"><p>A <code><a href="Data-CSV-Conduit.html#t:MapRow">MapRow</a></code> is a dictionary based on <code><a href="Data.html#v:Map">Map</a></code> where column names
are keys and row's individual cell values are the values of the
<code>Map</code>.</p></div></div><div class="top"><p class="src"><span class="keyword">type</span> <a name="t:Row" class="def">Row</a> a = [a] <a href="src/Data-CSV-Conduit-Types.html#Row" class="link">Source</a></p><div class="doc"><p>A <code><a href="Data-CSV-Conduit.html#t:Row">Row</a></code> is just a list of fields</p></div></div><h1 id="g:2">Re-exported For Convenience</h1><div class="top"><p class="src"><a name="v:runResourceT" class="def">runResourceT</a> :: <a href="file:///usr/share/doc/libghc-monad-control-doc/html/Control-Monad-Trans-Control.html#t:MonadBaseControl">MonadBaseControl</a> <a href="file:///usr/share/doc/ghc-doc/html/libraries/base-4.8.2.0/System-IO.html#t:IO">IO</a> m => <a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:ResourceT">ResourceT</a> m a -> m a</p><div class="doc"><p>Unwrap a <code><a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#t:ResourceT">ResourceT</a></code> transformer, and call all registered release actions.</p><p>Note that there is some reference counting involved due to <code><a href="file:///usr/share/doc/libghc-resourcet-doc/html/Control-Monad-Trans-Resource.html#v:resourceForkIO">resourceForkIO</a></code>.
If multiple threads are sharing the same collection of resources, only the
last call to <code>runResourceT</code> will deallocate the resources.</p><p>Since 0.3.0</p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.1</p></div></body></html>
|