forked from haskell-hvr/cassava
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Types.hs
36 lines (29 loc) · 918 Bytes
/
Types.hs
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
module Data.Csv.Types
(
-- * Core CSV types
Csv
, Record
, Header
, Name
, NamedRecord
, Field
) where
import qualified Data.ByteString as S
import qualified Data.HashMap.Strict as HM
import Data.Vector (Vector)
-- | CSV data represented as a Haskell vector of vector of
-- bytestrings.
type Csv = Vector Record
-- | A record corresponds to a single line in a CSV file.
type Record = Vector Field
-- | The header corresponds to the first line a CSV file. Not all CSV
-- files have a header.
type Header = Vector Name
-- | A header has one or more names, describing the data in the column
-- following the name.
type Name = S.ByteString
-- | A record corresponds to a single line in a CSV file, indexed by
-- the column name rather than the column index.
type NamedRecord = HM.HashMap S.ByteString S.ByteString
-- | A single field within a record.
type Field = S.ByteString