Safe Haskell | Safe |
---|---|
Language | Haskell2010 |
Sets of characters.
Using this is more efficint than Alt
:ng individual characters.
Synopsis
- data CharSet
- empty :: CharSet
- universe :: CharSet
- singleton :: Char -> CharSet
- insert :: Char -> CharSet -> CharSet
- union :: CharSet -> CharSet -> CharSet
- intersection :: CharSet -> CharSet -> CharSet
- complement :: CharSet -> CharSet
- difference :: CharSet -> CharSet -> CharSet
- size :: CharSet -> Int
- null :: CharSet -> Bool
- member :: Char -> CharSet -> Bool
- fromList :: String -> CharSet
- toList :: CharSet -> String
- fromIntervalList :: [(Char, Char)] -> CharSet
- toIntervalList :: CharSet -> [(Char, Char)]
Set of characters
Construction
universe
>>>
size universe
1114112
>>>
universe
CS.fromIntervalList [('\NUL','\1114111')]
complement :: CharSet -> CharSet Source #
Complement of a CharSet
Query
size :: CharSet -> Int Source #
Size of CharSet
>>>
size $ fromIntervalList [('a','f'), ('0','9')]
16
>>>
length $ toList $ fromIntervalList [('a','f'), ('0','9')]
16