HaXmlSource codeContentsIndex
Text.ParserCombinators.TextParser
Contents
The Parse class is a replacement for the Read class. It is a
Combinators specific to string input, lexed haskell-style
Re-export all the more general combinators too
Synopsis
type TextParser a = Parser Char a
class Parse a where
parse :: TextParser a
parseList :: TextParser [a]
parseByRead :: Read a => String -> TextParser a
word :: TextParser String
isWord :: String -> TextParser String
optionalParens :: TextParser a -> TextParser a
field :: Parse a => String -> TextParser a
constructors :: [(String, TextParser a)] -> TextParser a
enumeration :: Show a => String -> [a] -> TextParser a
module Text.ParserCombinators.Poly
The Parse class is a replacement for the Read class. It is a
type TextParser a = Parser Char aSource
A synonym for Parser Char, i.e. string input (no state)
class Parse a whereSource
The class Parse is a replacement for Read, operating over String input. Essentially, it permits better error messages for why something failed to parse. It is rather important that parse can read back exactly what is generated by the corresponding instance of show.
Methods
parse :: TextParser aSource
parseList :: TextParser [a]Source
show/hide Instances
Parse Bool
Parse Char
Parse Double
Parse Float
Parse Int
Parse Integer
Parse Ordering
Parse ()
(Parse a, Parse b) => Parse (a, b)
(Parse a, Parse b, Parse c) => Parse (a, b, c)
Parse a => Parse (Maybe a)
Parse a => Parse [a]
(Parse a, Parse b) => Parse (Either a b)
parseByRead :: Read a => String -> TextParser aSource
If there already exists a Read instance for a type, then we can make a Parser for it, but with only poor error-reporting.
Combinators specific to string input, lexed haskell-style
word :: TextParser StringSource
One lexical chunk (Haskell-style lexing).
isWord :: String -> TextParser StringSource
Ensure that the next input word is a given string. (Note the input is lexed as haskell, so wordbreaks at spaces, symbols, etc.)
optionalParens :: TextParser a -> TextParser aSource
Allow true string parens around an item.
field :: Parse a => String -> TextParser aSource
Deal with named field syntax.
constructors :: [(String, TextParser a)] -> TextParser aSource
Parse one of a bunch of alternative constructors.
enumeration :: Show a => String -> [a] -> TextParser aSource
Parse one of the given nullary constructors (an enumeration).
Re-export all the more general combinators too
module Text.ParserCombinators.Poly
Produced by Haddock version 0.8