burrito-1.1.0.2: Parse and render URI templates.

Safe HaskellSafe
LanguageHaskell2010

Burrito.Internal.Parse

Synopsis

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 ...)

choice :: ParsecT s u m a -> ParsecT s u m a -> ParsecT s u m a Source #

sepBy1 :: ParsecT s u m a -> ParsecT s u m x -> ParsecT s u m (NonEmpty a) Source #

name :: Stream s m Char => ParsecT s u m Name Source #

nonEmpty :: ParsecT s u m a -> ParsecT s u m (NonEmpty a) Source #