simple-parser-0.3.0: Simple parser combinators
Safe HaskellNone
LanguageHaskell2010

SimpleParser.Chunked

Synopsis

Documentation

class Monoid chunk => Chunked chunk token | chunk -> token where Source #

Chunked captures the basic relationship between tokens and chunks of them. Basically, these things behave like lists, sequences, text, etc.

Methods

consChunk :: token -> chunk -> chunk Source #

unconsChunk :: chunk -> Maybe (token, chunk) Source #

tokenToChunk :: token -> chunk Source #

tokensToChunk :: [token] -> chunk Source #

chunkToTokens :: chunk -> [token] Source #

chunkLength :: chunk -> Int Source #

chunkEmpty :: chunk -> Bool Source #

revTokensToChunk :: [token] -> chunk Source #

Some datatypes (like Seq) may admit a "better" implementation for building a chunk in reverse.

Instances

Instances details
Chunked Text Char Source # 
Instance details

Defined in SimpleParser.Chunked

Chunked [a] a Source # 
Instance details

Defined in SimpleParser.Chunked

Methods

consChunk :: a -> [a] -> [a] Source #

unconsChunk :: [a] -> Maybe (a, [a]) Source #

tokenToChunk :: a -> [a] Source #

tokensToChunk :: [a] -> [a] Source #

chunkToTokens :: [a] -> [a] Source #

chunkLength :: [a] -> Int Source #

chunkEmpty :: [a] -> Bool Source #

revTokensToChunk :: [a] -> [a] Source #

Chunked (Seq a) a Source # 
Instance details

Defined in SimpleParser.Chunked

class Chunked chunk Char => TextualChunked chunk where Source #

Captures textual streams.

Minimal complete definition

buildChunk, unpackChunk

Methods

buildChunk :: chunk -> Builder Source #

packChunk :: chunk -> Text Source #

unpackChunk :: Text -> chunk Source #

Instances

Instances details
TextualChunked Text Source # 
Instance details

Defined in SimpleParser.Chunked

a ~ Char => TextualChunked [a] Source # 
Instance details

Defined in SimpleParser.Chunked

Methods

buildChunk :: [a] -> Builder Source #

packChunk :: [a] -> Text Source #

unpackChunk :: Text -> [a] Source #

a ~ Char => TextualChunked (Seq a) Source # 
Instance details

Defined in SimpleParser.Chunked