servant-cassava-0.8: Servant CSV content-type for cassava

Safe HaskellNone
LanguageHaskell2010

Servant.CSV.Cassava

Contents

Description

A CSV empty datatype with MimeRender and MimeUnrender instances for cassava's encoding and decoding classes.

>>> type Eg = Get '[(CSV', MyEncodeOptions)] [(Int, String)]

Default encoding and decoding options are also provided, along with the CSV type synonym that uses them.

>>> type EgDefault = Get '[CSV] [(Int, String)]

Synopsis

Documentation

data CSV' Source #

Instances

Generic CSV' Source # 

Associated Types

type Rep CSV' :: * -> * #

Methods

from :: CSV' -> Rep CSV' x #

to :: Rep CSV' x -> CSV' #

Accept * (CSV', a) Source #
text/csv;charset=utf-8

Methods

contentType :: Proxy (CSV', a) ctype -> MediaType #

(DefaultOrdered a, ToNamedRecord a, EncodeOpts opt) => MimeRender * (CSV', opt) (Vector a) Source #

Encode with encodeDefaultOrderedByNameWith

Methods

mimeRender :: Proxy (CSV', opt) (Vector a) -> a -> ByteString #

(DefaultOrdered a, ToNamedRecord a, EncodeOpts opt) => MimeRender * (CSV', opt) [a] Source #

Encode with encodeDefaultOrderedByNameWith

Methods

mimeRender :: Proxy (CSV', opt) [a] -> a -> ByteString #

(FromRecord a, DecodeOpts opt) => MimeUnrender * (CSV', opt) (Vector a) Source #

Decode with decodeWith. Assumes data has headers, which are stripped.

Methods

mimeUnrender :: Proxy (CSV', opt) (Vector a) -> ByteString -> Either String a #

(FromRecord a, DecodeOpts opt) => MimeUnrender * (CSV', opt) [a] Source #

Decode with decodeWith. Assumes data has headers, which are stripped.

Methods

mimeUnrender :: Proxy (CSV', opt) [a] -> ByteString -> Either String a #

(ToNamedRecord a, EncodeOpts opt) => MimeRender * (CSV', opt) (Header, Vector a) Source #

Encode with encodeByNameWith. The Header param is used for determining the order of headers and fields.

Methods

mimeRender :: Proxy (CSV', opt) (Header, Vector a) -> a -> ByteString #

(ToNamedRecord a, EncodeOpts opt) => MimeRender * (CSV', opt) (Header, [a]) Source #

Encode with encodeByNameWith. The Header param is used for determining the order of headers and fields.

Methods

mimeRender :: Proxy (CSV', opt) (Header, [a]) -> a -> ByteString #

(FromNamedRecord a, DecodeOpts opt) => MimeUnrender * (CSV', opt) (Header, Vector a) Source # 

Methods

mimeUnrender :: Proxy (CSV', opt) (Header, Vector a) -> ByteString -> Either String a #

(FromNamedRecord a, DecodeOpts opt) => MimeUnrender * (CSV', opt) (Header, [a]) Source #

Decode with decodeByNameWith

Methods

mimeUnrender :: Proxy (CSV', opt) (Header, [a]) -> ByteString -> Either String a #

type Rep CSV' Source # 
type Rep CSV' = D1 (MetaData "CSV'" "Servant.CSV.Cassava" "servant-cassava-0.8-GxiMPXW0r3aK8O5RuwQt8s" False) V1

data DefaultOpts Source #

Instances

Generic DefaultOpts Source # 

Associated Types

type Rep DefaultOpts :: * -> * #

DecodeOpts DefaultOpts Source # 
EncodeOpts DefaultOpts Source # 
type Rep DefaultOpts Source # 
type Rep DefaultOpts = D1 (MetaData "DefaultOpts" "Servant.CSV.Cassava" "servant-cassava-0.8-GxiMPXW0r3aK8O5RuwQt8s" False) V1

Encoding

Instances

Encode Options

class EncodeOpts a where Source #

Minimal complete definition

encodeOpts

Decoding

Instances

Decode Options

class DecodeOpts a where Source #

Minimal complete definition

decodeOpts