Safe Haskell | None |
---|---|
Language | Haskell2010 |
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)]
Synopsis
- class EncodeOpts opt where
- encodeOpts :: Proxy opt -> EncodeOptions
- decodeOpts :: Proxy opt -> DecodeOptions
- csvContentType :: Proxy opt -> MediaType
- class EncodeList (hasHeader :: HasHeader) a where
- encodeList :: Proxy hasHeader -> EncodeOptions -> [a] -> ByteString
- data TabSeparatedOpts
- data DefaultOpts
- class SHasHeaderI (hasHeader :: HasHeader) where
- shasheader :: SHasHeader hasHeader
- data SHasHeader (hasHeader :: HasHeader) where
- type CSV = CSV' 'HasHeader DefaultOpts
- data CSV' (hasHeader :: HasHeader) opt
- shasheaderToBool :: SHasHeader hasHeader -> Bool
- lowerSHasHeader :: SHasHeader hasHeader -> HasHeader
- encodeOpts' :: forall opt hasHeader. (EncodeOpts opt, SHasHeaderI hasHeader) => Proxy opt -> Proxy hasHeader -> EncodeOptions
- data HasHeader
Documentation
class EncodeOpts opt where Source #
encodeOpts :: Proxy opt -> EncodeOptions Source #
decodeOpts :: Proxy opt -> DecodeOptions Source #
csvContentType :: Proxy opt -> MediaType Source #
Instances
EncodeOpts TabSeparatedOpts Source # | |
Defined in Servant.CSV.Cassava | |
EncodeOpts DefaultOpts Source # | |
Defined in Servant.CSV.Cassava |
class EncodeList (hasHeader :: HasHeader) a where Source #
A class to determine how to encode a list of elements
HasHeader
encode withencodeDefaultOrderedByNameWith
NoHeader
encode withencodeWith
Currently, it's not possible to encode without headers using encodeDefaultOrderedByNameWith
.
encodeList :: Proxy hasHeader -> EncodeOptions -> [a] -> ByteString Source #
Instances
ToRecord a => EncodeList 'NoHeader a Source # | |
Defined in Servant.CSV.Cassava encodeList :: Proxy 'NoHeader -> EncodeOptions -> [a] -> ByteString Source # | |
(DefaultOrdered a, ToNamedRecord a) => EncodeList 'HasHeader a Source # | |
Defined in Servant.CSV.Cassava encodeList :: Proxy 'HasHeader -> EncodeOptions -> [a] -> ByteString Source # |
data TabSeparatedOpts Source #
Options that work for tab delimited data, with content type text/tab-separated-values;charset=utf-8
Instances
Generic TabSeparatedOpts Source # | |
Defined in Servant.CSV.Cassava type Rep TabSeparatedOpts :: Type -> Type # from :: TabSeparatedOpts -> Rep TabSeparatedOpts x # to :: Rep TabSeparatedOpts x -> TabSeparatedOpts # | |
EncodeOpts TabSeparatedOpts Source # | |
Defined in Servant.CSV.Cassava | |
type Rep TabSeparatedOpts Source # | |
Defined in Servant.CSV.Cassava |
data DefaultOpts Source #
Default options, instances providing defaultDecodeOptions
and defaultEncodeOptions
, and content type text/csv;charset=utf-8
Instances
Generic DefaultOpts Source # | |
Defined in Servant.CSV.Cassava type Rep DefaultOpts :: Type -> Type # from :: DefaultOpts -> Rep DefaultOpts x # to :: Rep DefaultOpts x -> DefaultOpts # | |
EncodeOpts DefaultOpts Source # | |
Defined in Servant.CSV.Cassava | |
type Rep DefaultOpts Source # | |
Defined in Servant.CSV.Cassava |
class SHasHeaderI (hasHeader :: HasHeader) where Source #
Class to provide SHasHeader
implicitly.
shasheader :: SHasHeader hasHeader Source #
Instances
SHasHeaderI 'NoHeader Source # | |
Defined in Servant.CSV.Cassava | |
SHasHeaderI 'HasHeader Source # | |
Defined in Servant.CSV.Cassava |
data SHasHeader (hasHeader :: HasHeader) where Source #
'HasHeader singleton.
data CSV' (hasHeader :: HasHeader) opt Source #
Instances
shasheaderToBool :: SHasHeader hasHeader -> Bool Source #
lowerSHasHeader :: SHasHeader hasHeader -> HasHeader Source #
encodeOpts' :: forall opt hasHeader. (EncodeOpts opt, SHasHeaderI hasHeader) => Proxy opt -> Proxy hasHeader -> EncodeOptions Source #