| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Servant.CSV.Cassava
Description
A CSV empty datatype with MimeRender and MimeUnrender instances for
cassava's encoding and decoding classes.
>>>type Eg = Get '[CSV' 'HasHeader 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)]
- data CSV' hasHeader opt
- type CSV = CSV' HasHeader DefaultOpts
- data SHasHeader hasHeader where
- class SHasHeaderI hasHeader where
- shasheaderToBool :: SHasHeader hasHeader -> Bool
- lowerSHasHeader :: SHasHeader hasHeader -> HasHeader
- data DefaultOpts
- data TabSeparatedOpts
- class EncodeList hasHeader a where
- class EncodeOpts opt where
- encodeOpts' :: forall opt hasHeader. (EncodeOpts opt, SHasHeaderI hasHeader) => Proxy opt -> Proxy hasHeader -> EncodeOptions
- data HasHeader :: *
Documentation
data CSV' hasHeader opt Source #
Instances
| EncodeOpts opt => Accept * (CSV' hasHeader opt) Source # | Content type can be determined to coincide with encode opts. |
| (EncodeOpts opt, EncodeList hasHeader a) => MimeRender * (CSV' hasHeader opt) (Vector a) Source # | |
| (EncodeOpts opt, EncodeList hasHeader a) => MimeRender * (CSV' hasHeader opt) [a] Source # | |
| (FromRecord a, EncodeOpts opt, SHasHeaderI hasHeader) => MimeUnrender * (CSV' hasHeader opt) (Vector a) Source # | Decode with |
| (FromRecord a, EncodeOpts opt, SHasHeaderI hasHeader) => MimeUnrender * (CSV' hasHeader opt) [a] Source # | Decode with |
| (ToNamedRecord a, EncodeOpts opt, SHasHeaderI hasHeader) => MimeRender * (CSV' hasHeader opt) (Header, Vector a) Source # | Encode with |
| (ToNamedRecord a, EncodeOpts opt, SHasHeaderI hasHeader) => MimeRender * (CSV' hasHeader opt) (Header, [a]) Source # | Encode with |
| (FromNamedRecord a, EncodeOpts opt) => MimeUnrender * (CSV' HasHeader opt) (Header, Vector a) Source # | |
| (FromNamedRecord a, EncodeOpts opt) => MimeUnrender * (CSV' HasHeader opt) (Header, [a]) Source # | Decode with |
data SHasHeader hasHeader where Source #
'HasHeader singleton.
Constructors
| SHasHeader :: SHasHeader HasHeader | |
| SNoHeader :: SHasHeader NoHeader |
class SHasHeaderI hasHeader where Source #
Class to provide SHasHeader implicitly.
Minimal complete definition
Methods
shasheader :: SHasHeader hasHeader Source #
Instances
shasheaderToBool :: SHasHeader hasHeader -> Bool Source #
lowerSHasHeader :: SHasHeader hasHeader -> HasHeader Source #
data DefaultOpts Source #
Default options, instances providing defaultDecodeOptions and defaultEncodeOptions, and content type text/csv;charset=utf-8
Instances
data TabSeparatedOpts Source #
Options that work for tab delimited data, with content type text/tab-separated-values;charset=utf-8
Instances
Encoding
Instances
class EncodeList hasHeader a where Source #
A class to determine how to encode a list of elements
HasHeaderencode withencodeDefaultOrderedByNameWithNoHeaderencode withencodeWith
Currently, it's not possible to encode without headers using encodeDefaultOrderedByNameWith.
Minimal complete definition
Methods
encodeList :: Proxy hasHeader -> EncodeOptions -> [a] -> ByteString Source #
Instances
Encode/Decode Options
class EncodeOpts opt where Source #
Minimal complete definition
Methods
encodeOpts :: Proxy opt -> EncodeOptions Source #
decodeOpts :: Proxy opt -> DecodeOptions Source #
csvContentType :: Proxy opt -> MediaType Source #
Instances
encodeOpts' :: forall opt hasHeader. (EncodeOpts opt, SHasHeaderI hasHeader) => Proxy opt -> Proxy hasHeader -> EncodeOptions Source #