Module

URI.Path.Segment

#PathSegment

newtype PathSegment

A path segment. Can be empty, as this is required to represent some paths - segments are joined together with slashes, so in cases where a path contains multiple contiguous slashes this is represented by a group of empty path segments. Corresponds to segment in the spec.

Instances

#segmentFromString

segmentFromString :: String -> PathSegment

Constructs a segment value from a string, percent-encoding any characters that require it. Note that running this on a string that has already had percent-encoding applied will double-encode it, for those situations use unsafeSegmentFromString instead.

#segmentToString

segmentToString :: PathSegment -> String

Returns the string value for a segment, percent-decoding any characters that require it.

#unsafeSegmentFromString

unsafeSegmentFromString :: String -> PathSegment

Constructs a segment value from a string directly - no percent-encoding will be applied. This is useful when using a custom encoding scheme for the segment, to prevent double-encoding.

#unsafeSegmentToString

unsafeSegmentToString :: PathSegment -> String

Returns the string value for the segment without percent-decoding. Only "unsafe" in the sense that values this produces may need further decoding, the name is more for symmetry with the segmentFromString/ unsafeSegmentFromString pairing.

#parseSegment

parseSegment :: Parser String PathSegment

A parser for a segment component of a URI.

#printSegment

printSegment :: PathSegment -> String

A printer for a segment component of a URI.

#PathSegmentNZ

newtype PathSegmentNZ

A path segment that cannot be empty. Corresponds to segment-nz in the spec.

Instances

#segmentNZFromString

segmentNZFromString :: NonEmptyString -> PathSegmentNZ

Constructs a non-empty segment value from a string, percent-encoding any characters that require it. Note that running this on a string that has already had percent-encoding applied will double-encode it, for those situations use unsafeSegmentNZFromString instead.

#segmentNZToString

segmentNZToString :: PathSegmentNZ -> NonEmptyString

Returns the string value for a non-empty segment, percent-decoding any characters that require it.

#unsafeSegmentNZFromString

unsafeSegmentNZFromString :: NonEmptyString -> PathSegmentNZ

Constructs a non-empty segment value from a string directly - no percent-encoding will be applied. This is useful when using a custom encoding scheme for the segment, to prevent double-encoding.

#unsafeSegmentNZToString

unsafeSegmentNZToString :: PathSegmentNZ -> NonEmptyString

Returns the string value for a non-empty segment without percent-decoding. Only "unsafe" in the sense that values this produces may need further decoding, the name is more for symmetry with the segmentNZFromString/ unsafeSegmentNZFromString pairing.

#parseSegmentNZ

parseSegmentNZ :: Parser String PathSegmentNZ

A parser for a segment-nz component of a URI.

#printSegmentNZ

printSegmentNZ :: PathSegmentNZ -> String

A printer for a segment-nz component of a URI.

#PathSegmentNZNC

newtype PathSegmentNZNC

A path segment that cannot be empty or contain the : character. Corresponds to segment-nz-nc in the spec.

Instances

#segmentNZNCFromString

segmentNZNCFromString :: NonEmptyString -> PathSegmentNZNC

Constructs a non-empty-no-colon segment value from a string, percent-encoding any characters that require it. Note that running this on a string that has already had percent-encoding applied will double-encode it, for those situations use unsafeSegmentNZNCFromString instead.

#segmentNZNCToString

segmentNZNCToString :: PathSegmentNZNC -> NonEmptyString

Constructs a non-empty-no-colon segment value from a string directly - no percent-encoding will be applied. This is useful when using a custom encoding scheme for the segment, to prevent double-encoding.

#unsafeSegmentNZNCFromString

unsafeSegmentNZNCFromString :: NonEmptyString -> PathSegmentNZNC

Returns the string value for a non-empty-no-colon segment, percent-decoding any characters that require it.

#unsafeSegmentNZNCToString

unsafeSegmentNZNCToString :: PathSegmentNZNC -> NonEmptyString

Returns the string value for the non-empty-no-colon segment without percent-decoding. Only "unsafe" in the sense that values this produces may need further decoding, the name is more for symmetry with the segmentNZNCFromString/unsafeSegmentNZNCFromString pairing.

#parseSegmentNZNC

parseSegmentNZNC :: Parser String PathSegmentNZNC

A parser for a segment-nz-nc component of a URI.

#printSegmentNZNC

printSegmentNZNC :: PathSegmentNZNC -> String

A printer for a segment-nz-nc component of a URI.

#segmentChar

segmentChar :: Parser String Char

The supported path segment characters, excluding percent-encodings.

#segmentNCChar

segmentNCChar :: Parser String Char

The supported no-colon path segment characters, excluding percent-encodings.

Modules