#Scheme Source

newtype Scheme

The scheme part of an absolute URI. For example: http, ftp, git.


#fromString Source

fromString :: String -> Maybe Scheme

Attempts to create a Scheme from the passed string. The scheme component of a URI has no escape sequences, so this function will return Nothing if an invalid value is provided.

fromString "http" == Just (Scheme.unsafeFromString "http")
fromString "git+ssh" == Just (Scheme.unsafeFromString "git+ssh")
fromString "!!!" == Nothing
fromString "" == Nothing

#toString Source

toString :: Scheme -> NonEmptyString

Returns the string value for a scheme.

toString (unsafeFromString "http") == "http"
toString (unsafeFromString "git+ssh") == "git+ssh"

#unsafeFromString Source

unsafeFromString :: String -> Scheme

Constructs a Scheme part unsafely: if the value is not an acceptable scheme a runtime error will be thrown.

This is intended as a convenience when describing Schemes statically in PureScript code, in all other cases fromString should be used.

#parser Source

parser :: Parser String Scheme

A parser for the scheme component of a URI. Expects a scheme string followed by ':'.

#print Source

print :: Scheme -> String

A printer for the scheme component of a URI. Prints a scheme value followed by a ':'.