http-kinder-0.2.0.0: Generic kinds and types for working with HTTP

Safe HaskellNone
LanguageHaskell2010

Network.HTTP.Kinder.URI

Contents

Synopsis

Classes for encoding and decoding

class URIEncode a where Source

Determines a Text serialization of a type with URI segment representation.

Methods

uriEncode :: a -> Text Source

class URIDecode a where Source

Parses a Text serialization of a for some type from a representation as a URI segment.

Instances

URIDecode Int Source 
URIDecode Int8 Source 
URIDecode Int16 Source 
URIDecode Int32 Source 
URIDecode Int64 Source 
URIDecode Integer Source 
URIDecode Text Source

For URI segments this instance is the same as the one for Raw Text since URI segments don't contain quotations.

URIDecode (Raw Text) Source 

Extra serialization utilities

uriDecodeBS :: URIDecode a => ByteString -> Either String a Source

Since URIDecode assumes a Text-like representation but we may read a ByteString off the wire, this helper function first tries to decode the ByteString as UTF-8 Text then decodes according to URIDecode.