Skip to content
This repository
Browse code

Add an inline example of streaming

  • Loading branch information...
commit c0b87678f7bd2d9e9c335a0c6667d33593c8723d 1 parent 7e13f37
Johan Tibell authored

Showing 1 changed file with 15 additions and 0 deletions. Show diff stats Hide diff stats

  1. +15 0 Data/Csv/Streaming.hs
15 Data/Csv/Streaming.hs
@@ -6,6 +6,9 @@
6 6 -- a per-record basis.
7 7 module Data.Csv.Streaming
8 8 (
  9 + -- * Usage example
  10 + -- $example
  11 +
9 12 -- * Stream representation
10 13 -- $stream-representation
11 14 Records(..)
@@ -39,6 +42,18 @@ import qualified Data.Csv.Incremental as I
39 42 import Data.Csv.Parser
40 43 import Data.Csv.Types
41 44
  45 +-- $example
  46 +--
  47 +-- A short usage example:
  48 +--
  49 +-- @ for_ ('decode' False \"John,27\\r\\nJane,28\\r\\n\") $ \\ (name, age :: Int) ->
  50 +-- putStrLn $ name ++ \" is \" ++ show age ++ \" years old\"
  51 +-- @
  52 +--
  53 +-- N.B. The 'Foldable' instance, which is used above, skips records
  54 +-- that failed to convert. If you don't want this behavior, work
  55 +-- directly with the 'Cons' and 'Nil' constructors.
  56 +
42 57 -- $stream-representation
43 58 --
44 59 -- A stream of records is represented like a (lazy) list that may

0 comments on commit c0b8767

Please sign in to comment.
Something went wrong with that request. Please try again.