extensible-uri-0.1: Generic URIs that can be specialised to specific schemes

Codec.URI.PercentEncoding

Description

Fast percent-encoding and decoding for ByteStrings.

Synopsis

Documentation

data DelimitableOctet Source

FIXME: docs

Constructors

Delimiter !Word8 
Literal !Word8 

Instances

Eq DelimitableOctet 
Ord DelimitableOctet 
Hashable DelimitableOctet 
CoArbitrary DelimitableOctet 
Arbitrary DelimitableOctet 
Unbox DelimitableOctet 
Vector Vector DelimitableOctet 
MVector MVector DelimitableOctet 
IsString (Vector DelimitableOctet)

Decode every percent-encoded octets and turn every letters to Literals. Throws a runtime exception for DecodeErrors.

Hashable (Vector DelimitableOctet) 
CoArbitrary (Vector DelimitableOctet) 
Arbitrary (Vector DelimitableOctet) 

data DecodeError Source

Data type to represent a decoding error of percent-encoded strings.

Constructors

InvalidUpperHalf !Char

invalid upper half

InvalidLowerHalf !Char !Char

valid upper and invalid lower halves

MissingUpperHalf 
MissingLowerHalf !Char

valid upper half

encode :: (Char -> Bool) -> DelimitedByteString -> ByteStringSource

Encode a DelimitedByteString to percent-encoded ascii string using a predicate to determine which Literals should be encoded. Note that Delimiters are always passed through.

decode :: forall f. (Applicative f, Failure DecodeError f) => (Char -> Bool) -> ByteString -> f DelimitedByteStringSource

Decode a percent-encoded ascii string to DelimitedByteString using a predicate to determine which non-encoded letters should be considered to be delimiters. Note that encoded octets are always considered to be Literal.