picoparsec-0.1: Fast combinator parsing for bytestrings and text

CopyrightMario Blažević <blamario@yahoo.com> 2015
LicenseBSD3
MaintainerMario Blažević
Stabilityexperimental
Portabilityunknown
Safe HaskellSafe-Inferred
LanguageHaskell2010

Data.Picoparsec.State

Description

This module provides the basic support for parsing state.

To support state, the parser input must be a Stateful monoid. The parsing state thus becomes the final part of the input, accessible and modifiable during the parse. Be careful to account for the presence of state before the endOfInput! The following parser, for example, would loop forever:

many (setState "more" *> anyToken)

Synopsis

Documentation

getState :: Parser (Stateful s t) s Source

Returns the current user state.

putState :: s -> Parser (Stateful s t) () Source

Sets the current state.

modifyState :: (s -> s) -> Parser (Stateful s t) () Source

Modifies the current state.