Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- class EnumText c => Columnar c where
- data ColumnOptions c = ColumnOptions {
- _co_csv_nmd :: IsNamed
- _co_csv_eos :: EncodeOptions
- _co_csv_dos :: DecodeOptions
- _co_col_hdr :: WithColHeader
- _co_col_fmt :: RowNo -> c -> Builder -> Builder
- data IsNamed
- data WithColHeader
- newtype RowNo = RowNo {}
- headerRowNo :: RowNo
- firstRowNo :: RowNo
- rowNoSupply :: [RowNo]
- defaultPositionalColumnOptions :: ColumnOptions c
- defaultColumnOptions :: ColumnOptions c
- class Columnar c => IsRecord r c | r -> c, c -> r where
- zeroRecord :: r
- fieldMethods :: c -> FieldMethods r c
- class (Monoid r, IsRecord r c) => IsMonoidalRecord r c where
- monoidalFieldMethods :: c -> MonoidalFieldMethods r c
- data FieldMethods r c = (Buildable f, TextParsable f) => FieldMethods {}
- data MonoidalFieldMethods r c = (Buildable f, TextParsable f, Monoid f) => MonoidalFieldMethods {}
- data Records r c = Records {
- _recs_options :: ColumnOptions c
- _recs_vector :: Vector r
- class (IsRecord r c, Coercible m (IntMap r)) => IsRecordIntMap r c m | r -> c, c -> r, r -> m, m -> r where
- encodeRecordMap :: forall r c m. IsRecordIntMap r c m => m -> ByteString
- decodeRecordMap :: forall r c m. IsRecordIntMap r c m => ByteString -> Possibly m
- memptyRecordMap :: forall r c m. (Monoid r, IsRecordIntMap r c m) => m
- mappendRecordMap :: forall r c m. (Monoid r, IsRecordIntMap r c m) => m -> m -> m
- summarizeMap :: forall r c m. IsRecordIntMap r c m => m -> Text
- class (IsRecord r c, Coercible m (HashMap Text r)) => IsRecordHashMap r c m | r -> c, c -> r, r -> m, m -> r where
- recordTextKey :: r -> Text
- encodeRecordHashMap :: forall r c m. IsRecordHashMap r c m => m -> ByteString
- decodeRecordHashMap :: forall r c m. IsRecordHashMap r c m => ByteString -> Possibly m
- memptyRecordHashMap :: forall r c m. (Monoid r, IsRecordHashMap r c m) => m
- mappendRecordHashMap :: forall r c m. (Monoid r, IsRecordHashMap r c m) => m -> m -> m
- summarizeHashMap :: forall r c m. IsRecordHashMap r c m => m -> Text
- newtype Row c = Row {}
- data Rows c = Rows {
- _rows_options :: ColumnOptions c
- _rows_vector :: Vector (Row c)
- mkRows :: Columnar c => [Row c] -> Rows c
- mkRowsWith :: ColumnOptions c -> [Row c] -> Rows c
- getRows :: Rows c -> [Row c]
- mkRow :: (c -> Builder) -> Row c
- data ColumnarIx c = ColumnarIx
- listColumns :: Columnar c => ColumnarIx c -> [c]
- mkFieldMethods :: (TextParsable f, Buildable f) => Lens' r f -> FieldMethods r c
- mkMonoidalFieldMethods :: (TextParsable f, Buildable f, Monoid f) => Lens' r f -> MonoidalFieldMethods r c
- convertMonoidalFieldMethodsToFieldMethods :: MonoidalFieldMethods r c -> FieldMethods r c
- constructRecordMappend :: (Bounded c, Enum c) => (c -> MonoidalFieldMethods r c) -> r -> r -> r
- haskellRecords :: IsRecord r c => [r] -> Builder
- mkRecords :: Columnar c => [r] -> Records r c
- mkRecordsWith :: ColumnOptions c -> [r] -> Records r c
- buildRecord :: forall r c. IsRecord r c => r -> Builder
- encodeRecordsT :: forall r c. IsRecord r c => Records r c -> Text
- encodeRecords :: forall r c. IsRecord r c => Records r c -> ByteString
- decodeRecordsT :: IsRecord r c => Text -> Possibly (Records r c)
- decodeRecords :: IsRecord r c => ByteString -> Possibly (Records r c)
- parseRecord :: IsRecord r c => TextParser r
- decodeRecordsWithT :: IsRecord r c => ColumnOptions c -> Text -> Possibly (Records r c)
- decodeRecordsWith :: IsRecord r c => ColumnOptions c -> ByteString -> Possibly (Records r c)
- recordsToRows :: IsRecord r c => Records r c -> Rows c
- recordToRow :: IsRecord r c => r -> Row c
- rowsToRecords :: forall r c. IsRecord r c => Rows c -> Possibly (Records r c)
- rowToRecord :: forall r c. IsRecord r c => Row c -> Possibly r
- encodeColumnarCsv :: forall c. Columnar c => Rows c -> ByteString
- csvHeader :: Columnar c => ColumnarIx c -> Header
- decodeColumnarCsv :: Columnar c => ByteString -> Possibly (Rows c)
- decodeColumnarCsvWith :: Columnar c => ColumnOptions c -> ByteString -> Possibly (Rows c)
- recordFields :: forall r c. IsRecord r c => [(ByteString, r -> ByteString)]
- listRecords :: Columnar c => Records r c -> [r]
- mkNamedRecord :: [(ByteString, a -> ByteString)] -> a -> NamedRecord
- mkIntMap :: (a -> Int) -> [a] -> IntMap a
- module Text.Enum.Text
Documentation
class EnumText c => Columnar c where Source #
a columnar type enumerates the columns of a CSV/table; it is just an EnumText with options for CSV codecs and the table generators
Nothing
data ColumnOptions c Source #
ColumnOptions | |
|
Instances
Show (ColumnOptions c) Source # | |
Defined in Text.Columnar.Types showsPrec :: Int -> ColumnOptions c -> ShowS # show :: ColumnOptions c -> String # showList :: [ColumnOptions c] -> ShowS # |
are we generating/expecting a header for CSVs
Named | we are generating and expecting headers |
Positional HasHeader | we are not generating headers but possibly skipping them on read |
data WithColHeader Source #
are we generating/expecting a header for tabular data
Instances
Eq WithColHeader Source # | |
Defined in Text.Columnar.Types (==) :: WithColHeader -> WithColHeader -> Bool # (/=) :: WithColHeader -> WithColHeader -> Bool # | |
Ord WithColHeader Source # | |
Defined in Text.Columnar.Types compare :: WithColHeader -> WithColHeader -> Ordering # (<) :: WithColHeader -> WithColHeader -> Bool # (<=) :: WithColHeader -> WithColHeader -> Bool # (>) :: WithColHeader -> WithColHeader -> Bool # (>=) :: WithColHeader -> WithColHeader -> Bool # max :: WithColHeader -> WithColHeader -> WithColHeader # min :: WithColHeader -> WithColHeader -> WithColHeader # | |
Show WithColHeader Source # | |
Defined in Text.Columnar.Types showsPrec :: Int -> WithColHeader -> ShowS # show :: WithColHeader -> String # showList :: [WithColHeader] -> ShowS # |
which Row is being formatted
headerRowNo :: RowNo Source #
the header is row 0, first data row is 1
firstRowNo :: RowNo Source #
the header is row 0, first data row is 1
rowNoSupply :: [RowNo] Source #
the list of valid RowNo, starting with the first row (NOT the header)
class Columnar c => IsRecord r c | r -> c, c -> r where Source #
IsRecord combines the column type with the record type, each record type determining the column type and vice versa
zeroRecord :: r Source #
fieldMethods :: c -> FieldMethods r c Source #
class (Monoid r, IsRecord r c) => IsMonoidalRecord r c where Source #
IsRecord combines the column type with the record type, each record type determining the column type and vice versa
monoidalFieldMethods :: c -> MonoidalFieldMethods r c Source #
data FieldMethods r c Source #
for each column we need a lens the field of the record, which must be Buildable and TextParsable
(Buildable f, TextParsable f) => FieldMethods | |
data MonoidalFieldMethods r c Source #
if we need monoidal records then the fields must be Monoidal too.
(Buildable f, TextParsable f, Monoid f) => MonoidalFieldMethods | |
a record set contains the ColumnOptions along with the vector of records
Records | |
|
class (IsRecord r c, Coercible m (IntMap r)) => IsRecordIntMap r c m | r -> c, c -> r, r -> m, m -> r where Source #
encodeRecordMap :: forall r c m. IsRecordIntMap r c m => m -> ByteString Source #
encoding to an Intmap
decodeRecordMap :: forall r c m. IsRecordIntMap r c m => ByteString -> Possibly m Source #
decoding into an Intmap
memptyRecordMap :: forall r c m. (Monoid r, IsRecordIntMap r c m) => m Source #
often we will want to construct a Monoid Intmap from Monoid records
mappendRecordMap :: forall r c m. (Monoid r, IsRecordIntMap r c m) => m -> m -> m Source #
often we will want to construct a Monoid Intmap from Monoid records
summarizeMap :: forall r c m. IsRecordIntMap r c m => m -> Text Source #
provide evidence that Map is well formed
class (IsRecord r c, Coercible m (HashMap Text r)) => IsRecordHashMap r c m | r -> c, c -> r, r -> m, m -> r where Source #
recordTextKey :: r -> Text Source #
encodeRecordHashMap :: forall r c m. IsRecordHashMap r c m => m -> ByteString Source #
encoding to an Intmap
decodeRecordHashMap :: forall r c m. IsRecordHashMap r c m => ByteString -> Possibly m Source #
decoding into an Intmap
memptyRecordHashMap :: forall r c m. (Monoid r, IsRecordHashMap r c m) => m Source #
often we will want to construct a Monoid HashMap from Monoid records
mappendRecordHashMap :: forall r c m. (Monoid r, IsRecordHashMap r c m) => m -> m -> m Source #
often we will want to construct a Monoid HashMap from Monoid records
summarizeHashMap :: forall r c m. IsRecordHashMap r c m => m -> Text Source #
provide evidence that HashMap is well formed
Instances
Columnar c => Eq (Row c) Source # | |
Show (Row c) Source # | |
Columnar c => FromRecord (Row c) Source # | |
Defined in Text.Columnar.Types parseRecord :: Record -> Parser (Row c) # | |
Columnar c => ToRecord (Row c) Source # | |
Defined in Text.Columnar.Types | |
Columnar c => FromNamedRecord (Row c) Source # | |
Defined in Text.Columnar.Types parseNamedRecord :: NamedRecord -> Parser (Row c) # | |
Columnar c => ToNamedRecord (Row c) Source # | |
Defined in Text.Columnar.Types toNamedRecord :: Row c -> NamedRecord # |
Rows are used for generating tabular output and do not need access to any record type
Rows | |
|
mkRowsWith :: ColumnOptions c -> [Row c] -> Rows c Source #
data ColumnarIx c Source #
sometimes we just need the column type, as with listColumns
Instances
Show (ColumnarIx c) Source # | |
Defined in Text.Columnar.Types showsPrec :: Int -> ColumnarIx c -> ShowS # show :: ColumnarIx c -> String # showList :: [ColumnarIx c] -> ShowS # |
listColumns :: Columnar c => ColumnarIx c -> [c] Source #
mkFieldMethods :: (TextParsable f, Buildable f) => Lens' r f -> FieldMethods r c Source #
for constructing each field's FieldMethods
mkMonoidalFieldMethods :: (TextParsable f, Buildable f, Monoid f) => Lens' r f -> MonoidalFieldMethods r c Source #
for constructing each field's MonoidalFieldMethods
constructRecordMappend :: (Bounded c, Enum c) => (c -> MonoidalFieldMethods r c) -> r -> r -> r Source #
encode the list of records as a Haskell list of strings, one line per line, indented at two spaces
mkRecordsWith :: ColumnOptions c -> [r] -> Records r c Source #
buildRecord :: forall r c. IsRecord r c => r -> Builder Source #
encodeRecords :: forall r c. IsRecord r c => Records r c -> ByteString Source #
decodeRecords :: IsRecord r c => ByteString -> Possibly (Records r c) Source #
parseRecord :: IsRecord r c => TextParser r Source #
decodeRecordsWithT :: IsRecord r c => ColumnOptions c -> Text -> Possibly (Records r c) Source #
decodeRecordsWith :: IsRecord r c => ColumnOptions c -> ByteString -> Possibly (Records r c) Source #
recordToRow :: IsRecord r c => r -> Row c Source #
encodeColumnarCsv :: forall c. Columnar c => Rows c -> ByteString Source #
decodeColumnarCsv :: Columnar c => ByteString -> Possibly (Rows c) Source #
decodeColumnarCsvWith :: Columnar c => ColumnOptions c -> ByteString -> Possibly (Rows c) Source #
recordFields :: forall r c. IsRecord r c => [(ByteString, r -> ByteString)] Source #
listRecords :: Columnar c => Records r c -> [r] Source #
mkNamedRecord :: [(ByteString, a -> ByteString)] -> a -> NamedRecord Source #
module Text.Enum.Text