sv-core-0.3.1: Encode and decode separated values (CSV, PSV, ...)

Copyright(C) CSIRO 2017-2018
LicenseBSD3
MaintainerGeorge Wilson <george.wilson@data61.csiro.au>
Stabilityexperimental
Portabilitynon-portable
Safe HaskellNone
LanguageHaskell2010

Data.Sv.Encode.Type

Description

The core type for encoding

Synopsis

Documentation

newtype Encode a Source #

An Encode converts its argument into one or more textual fields, to be written out as CSV.

It is Semigroup, Monoid, Contravariant, Divisible, and Decidable, allowing for composition of these values to build bigger Encodes from smaller ones.

Constructors

Encode 

Fields

Instances
Contravariant Encode Source # 
Instance details

Defined in Data.Sv.Encode.Type

Methods

contramap :: (a -> b) -> Encode b -> Encode a #

(>$) :: b -> Encode b -> Encode a #

Divisible Encode Source # 
Instance details

Defined in Data.Sv.Encode.Type

Methods

divide :: (a -> (b, c)) -> Encode b -> Encode c -> Encode a #

conquer :: Encode a #

Decidable Encode Source # 
Instance details

Defined in Data.Sv.Encode.Type

Methods

lose :: (a -> Void) -> Encode a #

choose :: (a -> Either b c) -> Encode b -> Encode c -> Encode a #

Semigroup (Encode a) Source # 
Instance details

Defined in Data.Sv.Encode.Type

Methods

(<>) :: Encode a -> Encode a -> Encode a #

sconcat :: NonEmpty (Encode a) -> Encode a #

stimes :: Integral b => b -> Encode a -> Encode a #

Monoid (Encode a) Source # 
Instance details

Defined in Data.Sv.Encode.Type

Methods

mempty :: Encode a #

mappend :: Encode a -> Encode a -> Encode a #

mconcat :: [Encode a] -> Encode a #

newtype NameEncode a Source #

A NameEncode is an Encode with an attached column name.

It is Semigroup, Monoid, Contravariant, and Divisible, allowing for composition of these values to build bigger NameEncodes from smaller ones.

Notably, NameEncode is not Decidable, since taking the sum of column names does not make sense.

Constructors

NameEncode 
Instances
Contravariant NameEncode Source # 
Instance details

Defined in Data.Sv.Encode.Type

Methods

contramap :: (a -> b) -> NameEncode b -> NameEncode a #

(>$) :: b -> NameEncode b -> NameEncode a #

Divisible NameEncode Source # 
Instance details

Defined in Data.Sv.Encode.Type

Methods

divide :: (a -> (b, c)) -> NameEncode b -> NameEncode c -> NameEncode a #

conquer :: NameEncode a #

Semigroup (NameEncode a) Source # 
Instance details

Defined in Data.Sv.Encode.Type

Monoid (NameEncode a) Source # 
Instance details

Defined in Data.Sv.Encode.Type