-- Hoogle documentation, generated by Haddock -- See Hoogle, http://www.haskell.org/hoogle/ -- | A simple applicative parser -- -- A simple applicative parser in Parsec style @package appar @version 0.1.1 -- | Simple Applicative parser whose input is strict -- ByteString. The usage is the same as parsec. -- -- Parsec 3 provides features which Parsec 2 does not provide: -- -- -- -- But Haskell Platform includes Parsec 2, not Parsec 3. Installing -- Parsec 3 to Haskell Platform environment makes it mess. So, this -- library was implemented. module Text.Appar.ByteString -- | Parser synonym for strict ByteString. type Parser = MkParser ByteString -- | Run a parser. parse :: MkParser ByteString a -> ByteString -> Maybe a -- | char c parses a single character c. Returns the -- parsed character. char :: (Input inp) => Char -> MkParser inp Char -- | This parser succeeds for any character. Returns the parsed character. anyChar :: (Input inp) => MkParser inp Char -- | oneOf cs succeeds if the current character is in the supplied -- list of characters cs. Returns the parsed character. oneOf :: (Input inp) => String -> MkParser inp Char -- | As the dual of oneOf, noneOf cs succeeds if the -- current character not in the supplied list of characters -- cs. Returns the parsed character. noneOf :: (Input inp) => String -> MkParser inp Char -- | Parses a letter or digit (a character between '0' and '9'). Returns -- the parsed character. alphaNum :: (Input inp) => MkParser inp Char -- | Parses a digit. Returns the parsed character. digit :: (Input inp) => MkParser inp Char -- | Parses a hexadecimal digit (a digit or a letter between 'a' and 'f' or -- 'A' and 'F'). Returns the parsed character. hexDigit :: (Input inp) => MkParser inp Char -- | Parses a white space character (any character which satisfies -- isSpace) Returns the parsed character. space :: (Input inp) => MkParser inp Char -- | string s parses a sequence of characters given by s. -- Returns the parsed string string :: (Input inp) => String -> MkParser inp String -- | The parser try p behaves like parser p, except that it pretends that -- it hasn't consumed any input when an error occurs. try :: MkParser inp a -> MkParser inp a -- | choice ps tries to apply the parsers in the list ps -- in order, until one of them succeeds. Returns the value of the -- succeeding parser. choice :: [MkParser inp a] -> MkParser inp a -- | option x p tries to apply parser p. If p -- fails without consuming input, it returns the value x, -- otherwise the value returned by p. option :: a -> MkParser inp a -> MkParser inp a -- | skipMany p applies the parser p zero or more -- times, skipping its result. skipMany :: MkParser inp a -> MkParser inp () -- | skipSome p applies the parser p one or more -- times, skipping its result. skipSome :: MkParser inp a -> MkParser inp () -- | sepBy1 p sep parses one or more occurrences of -- p, separated by sep. Returns a list of values -- returned by p. sepBy1 :: MkParser inp a -> MkParser inp b -> MkParser inp [a] -- | manyTill p end applies parser p zero or more -- times until parser end succeeds. Returns the list of values -- returned by p. manyTill :: MkParser inp a -> MkParser inp b -> MkParser inp [a] -- | An infix synonym for fmap. (<$>) :: (Functor f) => (a -> b) -> f a -> f b -- | Replace all locations in the input with the same value. The default -- definition is fmap . const, but this may be -- overridden with a more efficient version. (<$) :: (Functor f) => forall a b. a -> f b -> f a -- | Sequential application. (<*>) :: (Applicative f) => forall a b. f (a -> b) -> f a -> f b -- | Sequence actions, discarding the value of the first argument. (*>) :: (Applicative f) => forall a b. f a -> f b -> f b -- | Sequence actions, discarding the value of the second argument. (<*) :: (Applicative f) => forall a b. f a -> f b -> f a -- | A variant of <*> with the arguments reversed. (<**>) :: (Applicative f) => f a -> f (a -> b) -> f b -- | An associative binary operation (<|>) :: (Alternative f) => forall a. f a -> f a -> f a -- | One or more. some :: (Alternative f) => forall a. f a -> f [a] -- | Zero or more. many :: (Alternative f) => forall a. f a -> f [a] -- | Lift a value. pure :: (Applicative f) => forall a. a -> f a data MkParser inp a P :: (inp -> (Maybe a, inp)) -> MkParser inp a -- | Getting the internal parser. runParser :: MkParser inp a -> inp -> (Maybe a, inp) -- | The class for parser input. class (Eq inp) => Input inp car :: (Input inp) => inp -> Char cdr :: (Input inp) => inp -> inp nil :: (Input inp) => inp isNil :: (Input inp) => inp -> Bool -- | The parser satisfy f succeeds for any character for which the -- supplied function f returns True. Returns the -- character that is actually parsed. satisfy :: (Input inp) => (Char -> Bool) -> MkParser inp Char instance Input ByteString -- | Simple Applicative parser whose input is lazy -- ByteString. The usage is the same as parsec. -- -- Parsec 3 provides features which Parsec 2 does not provide: -- -- -- -- But Haskell Platform includes Parsec 2, not Parsec 3. Installing -- Parsec 3 to Haskell Platform environment makes it mess. So, this -- library was implemented. module Text.Appar.LazyByteString -- | Parser synonym for strict ByteString. type Parser = MkParser ByteString -- | Run a parser. parse :: MkParser ByteString a -> ByteString -> Maybe a -- | char c parses a single character c. Returns the -- parsed character. char :: (Input inp) => Char -> MkParser inp Char -- | This parser succeeds for any character. Returns the parsed character. anyChar :: (Input inp) => MkParser inp Char -- | oneOf cs succeeds if the current character is in the supplied -- list of characters cs. Returns the parsed character. oneOf :: (Input inp) => String -> MkParser inp Char -- | As the dual of oneOf, noneOf cs succeeds if the -- current character not in the supplied list of characters -- cs. Returns the parsed character. noneOf :: (Input inp) => String -> MkParser inp Char -- | Parses a letter or digit (a character between '0' and '9'). Returns -- the parsed character. alphaNum :: (Input inp) => MkParser inp Char -- | Parses a digit. Returns the parsed character. digit :: (Input inp) => MkParser inp Char -- | Parses a hexadecimal digit (a digit or a letter between 'a' and 'f' or -- 'A' and 'F'). Returns the parsed character. hexDigit :: (Input inp) => MkParser inp Char -- | Parses a white space character (any character which satisfies -- isSpace) Returns the parsed character. space :: (Input inp) => MkParser inp Char -- | string s parses a sequence of characters given by s. -- Returns the parsed string string :: (Input inp) => String -> MkParser inp String -- | The parser try p behaves like parser p, except that it pretends that -- it hasn't consumed any input when an error occurs. try :: MkParser inp a -> MkParser inp a -- | choice ps tries to apply the parsers in the list ps -- in order, until one of them succeeds. Returns the value of the -- succeeding parser. choice :: [MkParser inp a] -> MkParser inp a -- | option x p tries to apply parser p. If p -- fails without consuming input, it returns the value x, -- otherwise the value returned by p. option :: a -> MkParser inp a -> MkParser inp a -- | skipMany p applies the parser p zero or more -- times, skipping its result. skipMany :: MkParser inp a -> MkParser inp () -- | skipSome p applies the parser p one or more -- times, skipping its result. skipSome :: MkParser inp a -> MkParser inp () -- | sepBy1 p sep parses one or more occurrences of -- p, separated by sep. Returns a list of values -- returned by p. sepBy1 :: MkParser inp a -> MkParser inp b -> MkParser inp [a] -- | manyTill p end applies parser p zero or more -- times until parser end succeeds. Returns the list of values -- returned by p. manyTill :: MkParser inp a -> MkParser inp b -> MkParser inp [a] -- | An infix synonym for fmap. (<$>) :: (Functor f) => (a -> b) -> f a -> f b -- | Replace all locations in the input with the same value. The default -- definition is fmap . const, but this may be -- overridden with a more efficient version. (<$) :: (Functor f) => forall a b. a -> f b -> f a -- | Sequential application. (<*>) :: (Applicative f) => forall a b. f (a -> b) -> f a -> f b -- | Sequence actions, discarding the value of the first argument. (*>) :: (Applicative f) => forall a b. f a -> f b -> f b -- | Sequence actions, discarding the value of the second argument. (<*) :: (Applicative f) => forall a b. f a -> f b -> f a -- | A variant of <*> with the arguments reversed. (<**>) :: (Applicative f) => f a -> f (a -> b) -> f b -- | An associative binary operation (<|>) :: (Alternative f) => forall a. f a -> f a -> f a -- | One or more. some :: (Alternative f) => forall a. f a -> f [a] -- | Zero or more. many :: (Alternative f) => forall a. f a -> f [a] -- | Lift a value. pure :: (Applicative f) => forall a. a -> f a data MkParser inp a P :: (inp -> (Maybe a, inp)) -> MkParser inp a -- | Getting the internal parser. runParser :: MkParser inp a -> inp -> (Maybe a, inp) -- | The class for parser input. class (Eq inp) => Input inp car :: (Input inp) => inp -> Char cdr :: (Input inp) => inp -> inp nil :: (Input inp) => inp isNil :: (Input inp) => inp -> Bool -- | The parser satisfy f succeeds for any character for which the -- supplied function f returns True. Returns the -- character that is actually parsed. satisfy :: (Input inp) => (Char -> Bool) -> MkParser inp Char instance Input ByteString -- | Simple Applicative parser whose input is String. The -- usage is the same as parsec. -- -- Parsec 3 provides features which Parsec 2 does not provide: -- -- -- -- But Haskell Platform includes Parsec 2, not Parsec 3. Installing -- Parsec 3 to Haskell Platform environment makes it mess. So, this -- library was implemented. module Text.Appar.String -- | Parser synonym for String. type Parser = MkParser String -- | Run a parser. parse :: MkParser ByteString a -> ByteString -> Maybe a -- | char c parses a single character c. Returns the -- parsed character. char :: (Input inp) => Char -> MkParser inp Char -- | This parser succeeds for any character. Returns the parsed character. anyChar :: (Input inp) => MkParser inp Char -- | oneOf cs succeeds if the current character is in the supplied -- list of characters cs. Returns the parsed character. oneOf :: (Input inp) => String -> MkParser inp Char -- | As the dual of oneOf, noneOf cs succeeds if the -- current character not in the supplied list of characters -- cs. Returns the parsed character. noneOf :: (Input inp) => String -> MkParser inp Char -- | Parses a letter or digit (a character between '0' and '9'). Returns -- the parsed character. alphaNum :: (Input inp) => MkParser inp Char -- | Parses a digit. Returns the parsed character. digit :: (Input inp) => MkParser inp Char -- | Parses a hexadecimal digit (a digit or a letter between 'a' and 'f' or -- 'A' and 'F'). Returns the parsed character. hexDigit :: (Input inp) => MkParser inp Char -- | Parses a white space character (any character which satisfies -- isSpace) Returns the parsed character. space :: (Input inp) => MkParser inp Char -- | string s parses a sequence of characters given by s. -- Returns the parsed string string :: (Input inp) => String -> MkParser inp String -- | The parser try p behaves like parser p, except that it pretends that -- it hasn't consumed any input when an error occurs. try :: MkParser inp a -> MkParser inp a -- | choice ps tries to apply the parsers in the list ps -- in order, until one of them succeeds. Returns the value of the -- succeeding parser. choice :: [MkParser inp a] -> MkParser inp a -- | option x p tries to apply parser p. If p -- fails without consuming input, it returns the value x, -- otherwise the value returned by p. option :: a -> MkParser inp a -> MkParser inp a -- | skipMany p applies the parser p zero or more -- times, skipping its result. skipMany :: MkParser inp a -> MkParser inp () -- | skipSome p applies the parser p one or more -- times, skipping its result. skipSome :: MkParser inp a -> MkParser inp () -- | sepBy1 p sep parses one or more occurrences of -- p, separated by sep. Returns a list of values -- returned by p. sepBy1 :: MkParser inp a -> MkParser inp b -> MkParser inp [a] -- | manyTill p end applies parser p zero or more -- times until parser end succeeds. Returns the list of values -- returned by p. manyTill :: MkParser inp a -> MkParser inp b -> MkParser inp [a] -- | An infix synonym for fmap. (<$>) :: (Functor f) => (a -> b) -> f a -> f b -- | Replace all locations in the input with the same value. The default -- definition is fmap . const, but this may be -- overridden with a more efficient version. (<$) :: (Functor f) => forall a b. a -> f b -> f a -- | Sequential application. (<*>) :: (Applicative f) => forall a b. f (a -> b) -> f a -> f b -- | Sequence actions, discarding the value of the first argument. (*>) :: (Applicative f) => forall a b. f a -> f b -> f b -- | Sequence actions, discarding the value of the second argument. (<*) :: (Applicative f) => forall a b. f a -> f b -> f a -- | A variant of <*> with the arguments reversed. (<**>) :: (Applicative f) => f a -> f (a -> b) -> f b -- | An associative binary operation (<|>) :: (Alternative f) => forall a. f a -> f a -> f a -- | One or more. some :: (Alternative f) => forall a. f a -> f [a] -- | Zero or more. many :: (Alternative f) => forall a. f a -> f [a] -- | Lift a value. pure :: (Applicative f) => forall a. a -> f a data MkParser inp a P :: (inp -> (Maybe a, inp)) -> MkParser inp a -- | Getting the internal parser. runParser :: MkParser inp a -> inp -> (Maybe a, inp) -- | The class for parser input. class (Eq inp) => Input inp car :: (Input inp) => inp -> Char cdr :: (Input inp) => inp -> inp nil :: (Input inp) => inp isNil :: (Input inp) => inp -> Bool -- | The parser satisfy f succeeds for any character for which the -- supplied function f returns True. Returns the -- character that is actually parsed. satisfy :: (Input inp) => (Char -> Bool) -> MkParser inp Char instance Input String