Data.Attoparsec.ByteString.FastSet

attoparsec-0.14.4: Fast combinator parsing for bytestrings and text

Copyright | Bryan O'Sullivan 2007-2015
License | BSD3
Maintainer | bos@serpentine.com
Stability | experimental
Portability | unknown
Safe Haskell | None
Language | Haskell2010

Data.Attoparsec.ByteString.FastSet

Contents

- Data type
- Construction
- Lookup
- Debugging
- Handy interface

Description

Fast set membership tests for `Word8` and 8-bit `Char` values. The set representation is unboxed for efficiency. For small sets, we test for membership using a binary search. For larger sets, we use a lookup table.

Synopsis

- data FastSet
- fromList :: [Word8] -> FastSet
- set :: ByteString -> FastSet
- memberChar :: Char -> FastSet -> Bool
- memberWord8 :: Word8 -> FastSet -> Bool
- fromSet :: FastSet -> ByteString
- charClass :: String -> FastSet

# Data type

data FastSet #

#### Instances

Instances details

Show FastSet # |
Instance details Defined in Data.Attoparsec.ByteString.FastSet Methods showsPrec :: Int -> FastSet -> ShowS # show :: FastSet -> String # showList :: [FastSet] -> ShowS #
Eq FastSet # |
Instance details Defined in Data.Attoparsec.ByteString.FastSet Methods (==) :: FastSet -> FastSet -> Bool # (/=) :: FastSet -> FastSet -> Bool #
Ord FastSet # |
Instance details Defined in Data.Attoparsec.ByteString.FastSet Methods compare :: FastSet -> FastSet -> Ordering # (<) :: FastSet -> FastSet -> Bool # (<=) :: FastSet -> FastSet -> Bool # (>) :: FastSet -> FastSet -> Bool # (>=) :: FastSet -> FastSet -> Bool # max :: FastSet -> FastSet -> FastSet # min :: FastSet -> FastSet -> FastSet #

# Construction

fromList :: [Word8] -> FastSet #

set :: ByteString -> FastSet #

Create a set.

# Lookup

memberChar :: Char -> FastSet -> Bool #

Check the set for membership. Only works with 8-bit characters: characters above code point 255 will give wrong answers.

memberWord8 :: Word8 -> FastSet -> Bool #

Check the set for membership.

# Debugging

fromSet :: FastSet -> ByteString #

# Handy interface

charClass :: String -> FastSet #