Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- data FileURI = FileURI {}
- data ParseSyntax
- parseFileURI :: ParseSyntax -> ByteString -> Either String FileURI
- fileURIStrictP :: Parser FileURI
- fileURIExtendedPosixP :: Parser FileURI
- fileURIExtendedWindowsP :: Parser FileURI
- pathAbsoluteP :: Parser ByteString
- uncAuthorityP :: Parser ByteString
- fileHostP :: Parser ByteString
- fileAbsoluteP :: Parser ByteString
- driveLetterP :: Parser Word8
- driveLetterP' :: Parser ByteString
- userInfoP :: Parser ByteString
- hostP :: Parser ByteString
- regNameP :: Parser ByteString
- ipLiteralP :: Parser ByteString
- ipVFutureP :: Parser ByteString
- ipV6P :: Parser ByteString
- ipV4P :: Parser ByteString
- pathAbEmpty :: Parser ByteString
- segmentP :: Parser ByteString
- segmentNZP :: Parser ByteString
- segmentNZNCP :: Parser ByteString
- pcharP :: Parser Word8
- pctEncodedP :: Parser Word8
- hexDigit :: Word8 -> Bool
- unreserved :: String
- subDelims :: String
- alphaNum :: String
- alpha :: String
- digit :: String
- oBracket :: Word8
- cBracket :: Word8
- colon :: Word8
- period :: Word8
- satisfyClass :: String -> Parser Word8
- sequenceM :: Monad m => [m ByteString] -> m ByteString
- parseBetween :: (Alternative m, Monad m) => Int -> Int -> m a -> m [a]
Documentation
>>>
:set -XOverloadedStrings
A parsed file URI. It can have an auth/host part.
FileURI | |
|
data ParseSyntax Source #
RFC syntax configuration.
StrictPosix | Only parses the strict syntax according to section 2 of RFC 8089, which is technically posix paths. |
ExtendedPosix | Also parses extended user information described in E.1 |
ExtendedWindows | Parses windows paths according to E.1, E.2 and E.3. Unlike the spec, posix paths are rejected. |
Instances
Show ParseSyntax Source # | |
Defined in System.URI.File.Internal showsPrec :: Int -> ParseSyntax -> ShowS # show :: ParseSyntax -> String # showList :: [ParseSyntax] -> ShowS # | |
Eq ParseSyntax Source # | |
Defined in System.URI.File.Internal (==) :: ParseSyntax -> ParseSyntax -> Bool # (/=) :: ParseSyntax -> ParseSyntax -> Bool # |
:: ParseSyntax | RFC syntax configuration |
-> ByteString | input file URI |
-> Either String FileURI |
Parse a file URI such as file:///foo/bar
into FileURI
.
>>>
parseFileURI StrictPosix "file:/path/to/file"
Right (FileURI {fileAuth = Nothing, filePath = "/path/to/file"})>>>
parseFileURI StrictPosix "file:///path/to/file"
Right (FileURI {fileAuth = Nothing, filePath = "/path/to/file"})>>>
parseFileURI StrictPosix "file://hostname/path/to/file"
Right (FileURI {fileAuth = Just "hostname", filePath = "/path/to/file"})>>>
parseFileURI StrictPosix "file://localhost/path/to/file"
Right (FileURI {fileAuth = Nothing, filePath = "/path/to/file"})>>>
parseFileURI StrictPosix "http://localhost/path/to/file"
Left "string">>>
parseFileURI StrictPosix "/path/to/file"
Left "string">>>
parseFileURI ExtendedWindows "file://///host.example.com/path/to/file"
Right (FileURI {fileAuth = Nothing, filePath = "//host.example.com/path/to/file"})>>>
parseFileURI ExtendedWindows "file:///c:/path/to/file"
Right (FileURI {fileAuth = Nothing, filePath = "c:/path/to/file"})>>>
parseFileURI ExtendedWindows "file:/c:/path/to/file"
Right (FileURI {fileAuth = Nothing, filePath = "c:/path/to/file"})>>>
parseFileURI ExtendedWindows "file:c:/path/to/file"
Right (FileURI {fileAuth = Nothing, filePath = "c:/path/to/file"})
fileURIStrictP :: Parser FileURI Source #
Parse a file URI according to the main ABNF in RFC 8089, without any extended rules, which is as follows:
file-URI = file-scheme ":" file-hier-part file-scheme = "file" file-hier-part = ( "//" auth-path ) / local-path auth-path = [ file-auth ] path-absolute local-path = path-absolute file-auth = "localhost" / host
fileURIExtendedPosixP :: Parser FileURI Source #
Parse a file URI according to the main ABNF in RFC 8089, with extended rule E.1.
file-URI = file-scheme ":" file-hier-part file-scheme = "file" file-hier-part = ( "//" auth-path ) / local-path auth-path = [ file-auth ] path-absolute local-path = path-absolute file-auth = "localhost" / [ userinfo "@" ] host
fileURIExtendedWindowsP :: Parser FileURI Source #
Parse a file URI according for windows according to E.1, E.2 and E.3. Unlike the spec, posix paths are rejected. The ABNF is a slight modification of Appendix F.
file-URI = file-scheme ":" file-hier-part file-scheme = "file" file-hier-part = ( "//" auth-path ) / local-path auth-path = [ file-auth ] file-absolute / unc-authority path-absolute local-path = drive-letter path-absolute / file-absolute file-auth = "localhost" / [ userinfo "@" ] host unc-authority = 2*3"/" file-host file-host = inline-IP IPv4address reg-name inline-IP = "%5B" ( IPv6address / IPvFuture ) "%5D" file-absolute = "/" drive-letter path-absolute drive-letter = ALPHA ":" / ALPHA "|"
driveLetterP' :: Parser ByteString Source #
Like driveLetterP
, but appends :
.
hostP :: Parser ByteString Source #
ipVFutureP :: Parser ByteString Source #
Parses IPVFuture addresses. See relevant section in RFC.
ipV6P :: Parser ByteString Source #
Parses IPV6 addresses. See relevant section in RFC.
ipV4P :: Parser ByteString Source #
Parses a valid IPV4 address
unreserved :: String Source #
sequenceM :: Monad m => [m ByteString] -> m ByteString Source #
parseBetween :: (Alternative m, Monad m) => Int -> Int -> m a -> m [a] Source #