Text.Regex.Applicative.StateQueue

regex-applicative-0.3.2.1: Regex-based parsing with applicative interface

Safe Haskell | Safe
Language | Haskell2010

Text.Regex.Applicative.StateQueue

Description

This internal module is exposed only for testing and benchmarking. You don't need to import it.

Synopsis

- data StateQueue a
- empty :: StateQueue a
- insert :: a -> StateQueue a -> StateQueue a
- insertUnique :: Int -> a -> StateQueue a -> StateQueue a
- getElements :: StateQueue a -> [a]

# Documentation

data StateQueue a #

`StateQueue` is a data structure that can efficiently insert elements (preserving their order) and check whether an element with the given `Int` key is already in the queue.

Instances

Foldable StateQueue # |
Methods fold :: Monoid m => StateQueue m -> m # foldMap :: Monoid m => (a -> m) -> StateQueue a -> m # foldr :: (a -> b -> b) -> b -> StateQueue a -> b # foldr' :: (a -> b -> b) -> b -> StateQueue a -> b # foldl :: (b -> a -> b) -> b -> StateQueue a -> b # foldl' :: (b -> a -> b) -> b -> StateQueue a -> b # foldr1 :: (a -> a -> a) -> StateQueue a -> a # foldl1 :: (a -> a -> a) -> StateQueue a -> a # toList :: StateQueue a -> [a] # null :: StateQueue a -> Bool # length :: StateQueue a -> Int # elem :: Eq a => a -> StateQueue a -> Bool # maximum :: Ord a => StateQueue a -> a # minimum :: Ord a => StateQueue a -> a # sum :: Num a => StateQueue a -> a # product :: Num a => StateQueue a -> a #
Eq a => Eq (StateQueue a) # |
Methods (==) :: StateQueue a -> StateQueue a -> Bool # (/=) :: StateQueue a -> StateQueue a -> Bool #
Show a => Show (StateQueue a) # |
Methods showsPrec :: Int -> StateQueue a -> ShowS # show :: StateQueue a -> String # showList :: [StateQueue a] -> ShowS #

empty :: StateQueue a #

The empty state queue

insert :: a -> StateQueue a -> StateQueue a #

Insert an element in the state queue without a key.

Since `insert` doesn't take a key, it won't affect any `insertUnique`.

insertUnique #

Arguments

:: Int | key
-> a |
-> StateQueue a |
-> StateQueue a |

Insert an element in the state queue, unless there is already an element with the same key

getElements :: StateQueue a -> [a] #

Get the list of all elements