parser package:distribution-opensuse

A simplified ParsecT parser that consumes some kind of character stream without requiring any particular state state.
Types that are instances of this class can be parsed and constructed from some character based text representation.
The most general way to run a parser over the Identity monad. runParser p state filePath input runs parser p on the input list of tokens input, obtained from source filePath with the initial user state st. The filePath is only used in error messages and may be the empty string. Returns either a ParseError (Left) or a value of type a (Right).
parseFromFile p fname
= do{ input <- readFile fname
; return (runParser p () fname input)
}
The most general way to run a parser. runParserT p state filePath input runs parser p on the input list of tokens input, obtained from source filePath with the initial user state st. The filePath is only used in error messages and may be the empty string. Returns a computation in the underlying monad m that return either a ParseError (Left) or a value of type a (Right).