Portability | unknown |
---|---|
Stability | experimental |
Maintainer | bos@serpentine.com |
Safe Haskell | Safe-Infered |
Data.Attoparsec.Internal.Types
Description
Simple, efficient parser combinators, loosely based on the Parsec library.
- newtype Parser t a = Parser {}
- type Failure t r = Input t -> Added t -> More -> [String] -> String -> IResult t r
- type Success t a r = Input t -> Added t -> More -> a -> IResult t r
- data IResult t r
- newtype Input t = I {
- unI :: t
- newtype Added t = A {
- unA :: t
- data More
- = Complete
- | Incomplete
- addS :: Monoid t => Input t -> Added t -> More -> Input t -> Added t -> More -> (Input t -> Added t -> More -> r) -> r
- noAdds :: Monoid t => Input t -> Added t -> More -> (Input t -> Added t -> More -> r) -> r
- (<>) :: Monoid m => m -> m -> m
Documentation
The core parser type. This is parameterised over the type t
of
string being processed.
This type is an instance of the following classes:
-
Monad
, wherefail
throws an exception (i.e. fails) with an error message. -
Functor
andApplicative
, which follow the usual definitions. -
MonadPlus
, wheremzero
fails (with no error message) andmplus
executes the right-hand parser if the left-hand one fails. When the parser on the right executes, the input is reset to the same state as the parser on the left started with. (In other words, Attoparsec is a backtracking parser that supports arbitrary lookahead.) -
Alternative
, which followsMonadPlus
.
Constructors
Parser | |
The result of a parse. This is parameterised over the type t
of string that was processed.
This type is an instance of Functor
, where fmap
transforms the
value in a Done
result.
Constructors
Fail t [String] String | The parse failed. The |
Partial (t -> IResult t r) | Supply this continuation with more input so that the parser can resume. To indicate that no more input is available, use an empty string. |
Done t r | The parse succeeded. The |
Have we read all available input?
Constructors
Complete | |
Incomplete |