parser-regex-0.2.0.1: Regex based parsers
Safe HaskellNone
LanguageHaskell2010

Regex.Internal.CharSet

Description

This is an internal module. You probably don't need to import this. Import Data.CharSet instead.

WARNING

Definitions in this module allow violating invariants that would otherwise be guaranteed by non-internal modules. Use at your own risk!

Synopsis

Documentation

newtype CharSet Source #

A set of Chars.

The members are stored as contiguous ranges of Chars. This is efficient when the members form contiguous ranges since many Chars can be represented with just one range.

Constructors

CharSet 

Fields

Instances

Instances details
Monoid CharSet Source #

mempty = empty

Instance details

Defined in Regex.Internal.CharSet

Semigroup CharSet Source #

(<>) = union

Instance details

Defined in Regex.Internal.CharSet

IsString CharSet Source #

fromString = fromList

Instance details

Defined in Regex.Internal.CharSet

Methods

fromString :: String -> CharSet #

Show CharSet Source # 
Instance details

Defined in Regex.Internal.CharSet

Eq CharSet Source # 
Instance details

Defined in Regex.Internal.CharSet

Methods

(==) :: CharSet -> CharSet -> Bool #

(/=) :: CharSet -> CharSet -> Bool #

empty :: CharSet Source #

The empty set.

singleton :: Char -> CharSet Source #

\(O(1)\). A set of one Char.

fromRange :: (Char, Char) -> CharSet Source #

\(O(1)\). A Char range (inclusive).

fromList :: [Char] -> CharSet Source #

\(O(s \min(s,C))\). Create a set from Chars in a list.

fromRanges :: [(Char, Char)] -> CharSet Source #

\(O(n \min(n,C))\). Create a set from the given Char ranges (inclusive).

insert :: Char -> CharSet -> CharSet Source #

\(O(\min(n,C))\). Insert a Char into a set.

insertRange :: (Char, Char) -> CharSet -> CharSet Source #

\(O(\min(n,C))\). Insert all Chars in a range (inclusive) into a set.

delete :: Char -> CharSet -> CharSet Source #

\(O(\min(n,C))\). Delete a Char from a set.

deleteRange :: (Char, Char) -> CharSet -> CharSet Source #

\(O(\min(n,C))\). Delete a Char range (inclusive) from a set.

map :: (Char -> Char) -> CharSet -> CharSet Source #

\(O(s \min(s,C))\). Map a function over all Chars in a set.

not :: CharSet -> CharSet Source #

\(O(n)\). The complement of a set.

union :: CharSet -> CharSet -> CharSet Source #

\(O(m \min(n+m,C))\). The union of two sets.

Prefer strict left-associative unions, since this is a strict structure and the runtime is linear in the size of the second argument.

difference :: CharSet -> CharSet -> CharSet Source #

\(O(m \min(n+m,C))\). The difference of two sets.

intersection :: CharSet -> CharSet -> CharSet Source #

\(O(n + m \min(n+m,C))\). The intersection of two sets.

member :: Char -> CharSet -> Bool Source #

\(O(\min(n,C))\). Whether a Char is in a set.

notMember :: Char -> CharSet -> Bool Source #

\(O(\min(n,C))\). Whether a Char is not in a set.

elems :: CharSet -> [Char] Source #

\(O(s)\). The Chars in a set.

ranges :: CharSet -> [(Char, Char)] Source #

\(O(n)\). The contiguous ranges of Chars in a set.

valid :: CharSet -> Bool Source #

Is the internal structure of the set valid?