Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- parse :: String -> Maybe Template
- template :: Stream s m Char => ParsecT s u m Template
- token :: Stream s m Char => ParsecT s u m Token
- choice :: ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a
- expression :: Stream s m Char => ParsecT s u m Expression
- operator :: Stream s m Char => ParsecT s u m Operator
- sepBy1 :: ParsecT s u m a -> ParsecT s u m x -> ParsecT s u m (NonEmpty a)
- variable :: Stream s m Char => ParsecT s u m Variable
- name :: Stream s m Char => ParsecT s u m Name
- field :: Stream s m Char => ParsecT s u m Field
- nonEmpty :: ParsecT s u m a -> ParsecT s u m (NonEmpty a)
- fieldCharacter :: Stream s m Char => ParsecT s u m (Character Field)
- encodedCharacter :: Stream s m Char => ParsecT s u m (Character tag)
- digit :: Stream s m Char => ParsecT s u m Digit
- unencodedCharacter :: Stream s m Char => (Char -> Bool) -> ParsecT s u m (Character tag)
- isFieldCharacter :: Char -> Bool
- modifier :: Stream s m Char => ParsecT s u m Modifier
- maxLength :: Stream s m Char => ParsecT s u m MaxLength
- isMaxLength :: Int -> Bool
- literal :: Stream s m Char => ParsecT s u m Literal
- literalCharacter :: Stream s m Char => ParsecT s u m (Character Literal)
- isLiteralCharacter :: Char -> Bool
Documentation
parse :: String -> Maybe Template Source #
Attempts to parse a string as a URI template. If parsing fails, this will
return Nothing
. Otherwise it will return Just
the parsed template.
Parsing will usually succeed, but it can fail if the input string contains
characters that are not valid in IRIs (like ^
) or if the input string
contains an invalid template expression (like {!}
). To include characters
that aren't valid in IRIs, percent encode them (like %5E
).
>>>
parse "invalid template"
Nothing>>>
parse "valid-template"
Just (Template ...)
expression :: Stream s m Char => ParsecT s u m Expression Source #
isFieldCharacter :: Char -> Bool Source #
isMaxLength :: Int -> Bool Source #
isLiteralCharacter :: Char -> Bool Source #