Fast percent-encoding and decoding for ByteStrings.
- data DelimitableOctet
- type DelimitedByteString = Vector DelimitableOctet
- data DecodeError
- encode :: (Char -> Bool) -> DelimitedByteString -> ByteString
- decode :: forall f. (Applicative f, Failure DecodeError f) => (Char -> Bool) -> ByteString -> f DelimitedByteString
Documentation
data DelimitableOctet Source
FIXME: docs
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
|
Hashable (Vector DelimitableOctet) | |
CoArbitrary (Vector DelimitableOctet) | |
Arbitrary (Vector DelimitableOctet) |
type DelimitedByteString = Vector DelimitableOctetSource
FIXME: doc
data DecodeError Source
Data type to represent a decoding error of percent-encoded strings.
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 Literal
s should be
encoded. Note that Delimiter
s 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
.