Copyright | (C) CSIRO 2017-2018 |
---|---|
License | BSD3 |
Maintainer | George Wilson <george.wilson@data61.csiro.au> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
This module contains datatypes for Records. A record is a "line" or "row" of a CSV document
Synopsis
- newtype Record s = Record {
- _fields :: NonEmptyVector (Spaced (Field s))
- class HasRecord s t a b | s -> a, t -> b where
- recordSpacedFieldsIso :: Iso (Record s) (Record a) (NonEmptyVector (Spaced (Field s))) (NonEmptyVector (Spaced (Field a)))
- emptyRecord :: Monoid s => Record s
- singleField :: Field s -> Record s
- recordNel :: NonEmpty (SpacedField s) -> Record s
- data Records s
- class HasRecords c s | c -> s where
- _EmptyRecords :: Prism' (Records s) ()
- _NonEmptyRecords :: Prism (Records s) (Records t) (Record s, Vector (Newline, Record s)) (Record t, Vector (Newline, Record t))
- mkRecords :: Newline -> NonEmpty (Record s) -> Records s
- singleRecord :: Record s -> Records s
- recordList :: HasRecords c s => c -> [Record s]
Documentation
A Record
is a non-empty collection of Fields, implicitly separated
by a separator (often a comma).
Record | |
|
Instances
class HasRecord s t a b | s -> a, t -> b where Source #
Classy lenses for Record
record :: Lens s t (Record a) (Record b) Source #
spacedFields :: Lens s t (NonEmptyVector (Spaced (Field a))) (NonEmptyVector (Spaced (Field b))) Source #
recordSpacedFieldsIso :: Iso (Record s) (Record a) (NonEmptyVector (Spaced (Field s))) (NonEmptyVector (Spaced (Field a))) Source #
A Record
is isomorphic to a NonEmpty
list of SpacedField
s
emptyRecord :: Monoid s => Record s Source #
A collection of records, separated by newlines.
Instances
class HasRecords c s | c -> s where Source #
Classy lenses for Records
records :: Lens' c (Records s) Source #
traverseRecords :: Traversal' c (Record s) Source #
Instances
HasRecords (Records s) s Source # | |
Defined in Data.Svfactor.Syntax.Record records :: Lens' (Records s) (Records s) Source # traverseRecords :: Traversal' (Records s) (Record s) Source # traverseNewlines :: Traversal' (Records s) Newline Source # | |
HasRecords (Sv s) s Source # | |
Defined in Data.Svfactor.Syntax.Sv records :: Lens' (Sv s) (Records s) Source # traverseRecords :: Traversal' (Sv s) (Record s) Source # traverseNewlines :: Traversal' (Sv s) Newline Source # |
_NonEmptyRecords :: Prism (Records s) (Records t) (Record s, Vector (Newline, Record s)) (Record t, Vector (Newline, Record t)) Source #
Prism for a non-empty Records
mkRecords :: Newline -> NonEmpty (Record s) -> Records s Source #
Convenience constructor for Records
.
This puts the same newline between all the records.
singleRecord :: Record s -> Records s Source #
A record collection conaining one record
recordList :: HasRecords c s => c -> [Record s] Source #
Collect the list of Record
s from anything that HasRecords