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
- 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 | |
|
Functor Record Source # | |
Foldable Record Source # | |
Traversable Record Source # | |
Eq s => Eq (Record s) Source # | |
Ord s => Ord (Record s) Source # | |
Show s => Show (Record s) Source # | |
Generic (Record s) Source # | |
Semigroup (Record s) Source # | |
NFData s => NFData (Record s) Source # | |
HasFields (Record a) (Record b) a b Source # | |
HasRecord (Record a) (Record b) a b Source # | |
type Rep (Record s) Source # | |
class HasRecord s t a b | s -> a, t -> b where Source #
Classy lenses for Record
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.
Functor Records Source # | |
Foldable Records Source # | |
Traversable Records Source # | |
Eq s => Eq (Records s) Source # | |
Ord s => Ord (Records s) Source # | |
Show s => Show (Records s) Source # | |
Generic (Records s) Source # | |
NFData s => NFData (Records s) Source # | |
HasRecords (Records s) s Source # | |
type Rep (Records s) Source # | |
class HasRecords c s | c -> s where Source #
Classy lenses for Records
records :: Lens' c (Records s) Source #
traverseRecords :: Traversal' c (Record s) Source #
HasRecords (Records s) s Source # | |
HasRecords (Sv s) s 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