Files
dotfiles/cabal/share/doc/x86_64-osx-ghc-7.10.1/MissingH-1.3.0.1/html/Data-CSV.html
2015-04-05 17:47:08 +02:00

24 lines
4.3 KiB
HTML

<!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</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.html");};
//]]>
</script></head><body><div id="package-header"><ul class="links" id="page-menu"><li><a href="index.html">Contents</a></li><li><a href="doc-index.html">Index</a></li></ul><p class="caption">MissingH-1.3.0.1: Large utility library</p></div><div id="content"><div id="module-header"><table class="info"><tr><th>Copyright</th><td>Copyright (C) 2005-2011 John Goerzen</td></tr><tr><th>License</th><td>BSD3</td></tr><tr><th>Maintainer</th><td>John Goerzen &lt;jgoerzen@complete.org&gt;</td></tr><tr><th>Stability</th><td>provisional</td></tr><tr><th>Portability</th><td>portable</td></tr><tr><th>Safe Haskell</th><td>None</td></tr><tr><th>Language</th><td>Haskell98</td></tr></table><p class="caption">Data.CSV</p></div><div id="description"><p class="caption">Description</p><div class="doc"><p>Haskell Parsec parsers for comma-separated value (CSV) files.</p><p>Written by John Goerzen, jgoerzen@complete.org</p></div></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:csvFile">csvFile</a> :: CharParser st [[<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]]</li><li class="src short"><a href="#v:genCsvFile">genCsvFile</a> :: [[<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]] -&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></li></ul></div><div id="interface"><h1>Documentation</h1><div class="top"><p class="src"><a name="v:csvFile" class="def">csvFile</a> :: CharParser st [[<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]]</p><div class="doc"><p>Parse a Comma-Separated Value (CSV) file. The return value is a list of
lines; each line is a list of cells; and each cell is a String.</p><p>Please note that CSV files may have a different number of cells on each line.
Also, it is impossible to distinguish a CSV line that has a call with no data
from a CSV line that has no cells.</p><p>Here are some examples:</p><pre>Input (literal strings) Parses As (Haskell String syntax)
-------------------------------- ---------------------------------
1,2,3 [[&quot;1&quot;, &quot;2&quot;, &quot;3&quot;]]
l1 [[&quot;l1&quot;], [&quot;l2&quot;]]
l2
(empty line) [[&quot;&quot;]]
NQ,&quot;Quoted&quot; [[&quot;NQ&quot;, &quot;Quoted&quot;]]
NQ,&quot;Embedded&quot;&quot;Quote&quot; [[&quot;NQ&quot;, &quot;Embedded\&quot;Quote&quot;]]</pre><p>To parse a String, you might use:</p><pre>import Text.ParserCombinators.Parsec
import Data.String.CSV
....
parse csvFile &quot;&quot; mystring</pre><p>To parse a file, you might instead use:</p><pre>do result &lt;- parseFromFile csvFile &quot;/path/to/file&quot;</pre><p>Please note that the result of parsing will be of type
(Either ParseError [[String]]). A Left result indicates an error.
For more details, see the Parsec information.</p></div></div><div class="top"><p class="src"><a name="v:genCsvFile" class="def">genCsvFile</a> :: [[<a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a>]] -&gt; <a href="file:///usr/local/Cellar/ghc/7.10.1/share/doc/ghc/html/libraries/base-4.8.0.0/Data-String.html#t:String">String</a></p><div class="doc"><p>Generate CSV data for a file. The resulting string can be
written out to disk directly. </p></div></div></div></div><div id="footer"><p>Produced by <a href="http://www.haskell.org/haddock/">Haddock</a> version 2.16.0</p></div></body></html>