LParse-0.2.3.0: A continuation-based parser library

Copyright(c) Marcus Völker 2017
LicenseMIT
Maintainermarcus.voelker@rwth-aachen.de
Safe HaskellSafe
LanguageHaskell2010

Text.LParse.TokenStream

Description

This module contains the TokenStream class, an abstraction of lists, similar to Traversable, but geared for use with LParse

Synopsis

Documentation

class (Functor t, Foldable t) => TokenStream t where Source #

TokenStream abstracts a list, i.e., something that has a next element to process and a rest afterwards

Methods

top :: t a -> a Source #

top gives the next element to process. Similar to head

rest :: t a -> t a Source #

rest gives what is left after processing top. Similar to tail

nil :: t a Source #

nil gives the empty TokenStream. Similar to `[]`

cons :: a -> t a -> t a Source #

cons prepends an element to the TokenStream. Similar to `(:)`

Instances
TokenStream [] Source # 
Instance details

Defined in Text.LParse.TokenStream

Methods

top :: [a] -> a Source #

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

nil :: [a] Source #

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

TokenStream Maybe Source # 
Instance details

Defined in Text.LParse.TokenStream

Methods

top :: Maybe a -> a Source #

rest :: Maybe a -> Maybe a Source #

nil :: Maybe a Source #

cons :: a -> Maybe a -> Maybe a Source #

TokenStream (Either a) Source # 
Instance details

Defined in Text.LParse.TokenStream

Methods

top :: Either a a0 -> a0 Source #

rest :: Either a a0 -> Either a a0 Source #

nil :: Either a a0 Source #

cons :: a0 -> Either a a0 -> Either a a0 Source #

skipN :: TokenStream s => Int -> s a -> s a Source #

Deprecated: Use sDrop in place of skipN

Deprecated version of sDrop

sDrop :: TokenStream s => Int -> s a -> s a Source #

TokenStream version of drop

sZip :: TokenStream s => s a -> s b -> s (a, b) Source #

TokenStream version of zip

sZipWith :: TokenStream s => (a -> b -> c) -> s a -> s b -> s c Source #

TokenStream version of zipWith

sFilter :: TokenStream s => (a -> Bool) -> s a -> s a Source #

TokenStream version of filter