Copyright | (c) Lev Dvorkin 2022 |
---|---|
License | MIT |
Maintainer | [email protected] |
Stability | Experimental |
Safe Haskell | None |
Language | Haskell2010 |
Text.Tokenizer.BlackWhiteSet
Description
This module contains auxillary set structure to store effectively small sets of symbols and complementary to them
Synopsis
- data BlackWhiteSet c
- singleton :: c -> BlackWhiteSet c
- intersection :: Ord c => BlackWhiteSet c -> BlackWhiteSet c -> BlackWhiteSet c
- isEmpty :: BlackWhiteSet c -> Bool
- member :: Ord c => c -> BlackWhiteSet c -> Bool
Documentation
data BlackWhiteSet c Source #
Select some "white set" of available elements or "black set" of forbidden ones
Instances
Eq c => Eq (BlackWhiteSet c) Source # | |
Defined in Text.Tokenizer.BlackWhiteSet Methods (==) :: BlackWhiteSet c -> BlackWhiteSet c -> Bool # (/=) :: BlackWhiteSet c -> BlackWhiteSet c -> Bool # | |
Ord c => Ord (BlackWhiteSet c) Source # | |
Defined in Text.Tokenizer.BlackWhiteSet Methods compare :: BlackWhiteSet c -> BlackWhiteSet c -> Ordering # (<) :: BlackWhiteSet c -> BlackWhiteSet c -> Bool # (<=) :: BlackWhiteSet c -> BlackWhiteSet c -> Bool # (>) :: BlackWhiteSet c -> BlackWhiteSet c -> Bool # (>=) :: BlackWhiteSet c -> BlackWhiteSet c -> Bool # max :: BlackWhiteSet c -> BlackWhiteSet c -> BlackWhiteSet c # min :: BlackWhiteSet c -> BlackWhiteSet c -> BlackWhiteSet c # | |
Show c => Show (BlackWhiteSet c) Source # | |
Defined in Text.Tokenizer.BlackWhiteSet Methods showsPrec :: Int -> BlackWhiteSet c -> ShowS # show :: BlackWhiteSet c -> String # showList :: [BlackWhiteSet c] -> ShowS # |
Some simple utilities to work with BlackWhiteSet
singleton :: c -> BlackWhiteSet c Source #
Make a BlackWhiteSet
containing only one symbol
intersection :: Ord c => BlackWhiteSet c -> BlackWhiteSet c -> BlackWhiteSet c Source #
Intersect two BlackWhiteSet
s.
isEmpty :: BlackWhiteSet c -> Bool Source #
Check if BlackWhiteSet
is empty
NB! number of all elements assumed to be too large, so BlackSet
is never
supposed to be empty
member :: Ord c => c -> BlackWhiteSet c -> Bool Source #
Check if symbol is a member of a BlackWhiteSet
>>>
member 'a' (WhiteSet (S.fromList ['a', 'b']))
True
>>>
member 'a' (BlackSet (S.fromList ['a', 'b']))
False