Module

URI.UserInfo

Package
purescript-uri
Repository
slamdata/purescript-uri

#UserInfo Source

newtype UserInfo

The user info part of an Authority. For example: user, foo:bar.

This type treats the entire string as an undifferentiated blob, if you would like to specifically deal with the user:password format, take a look at URI.Extra.UserPassInfo.

Instances

#fromString Source

fromString :: NonEmptyString -> UserInfo

Constructs a user-info 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 unsafeFromString instead.

fromString "foo" = unsafeFromString "foo"
fromString "foo@bar" = unsafeFromString "foo%40bar"
fromString "foo%40bar" = unsafeFromString "foo%2540bar"

#toString Source

toString :: UserInfo -> NonEmptyString

Returns the string value for user-info, percent-decoding any characters that require it.

toString (unsafeFromString "foo") = "foo"
toString (unsafeFromString "foo%40bar") = "foo@bar"

#unsafeFromString Source

unsafeFromString :: NonEmptyString -> UserInfo

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

#unsafeToString Source

unsafeToString :: UserInfo -> NonEmptyString

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

#parser Source

parser :: Parser String UserInfo

A parser for the user-info component of a URI.

#print Source

print :: UserInfo -> String

A printer for the user-info component of a URI.

#userInfoChar Source

userInfoChar :: Parser String Char

The supported user info characters, excluding percent-encodings.