bitset-word8

Space efficient set of Word8 and some pre-canned sets useful for parsing HTTP

https://github.com/nshimaza/bitset-word8#readme

Version on this page:0.1.1.0
LTS Haskell 22.37:0.1.1.2
Stackage Nightly 2024-10-11:0.1.1.2
Latest on Hackage:0.1.1.2

See all snapshots bitset-word8 appears in

MIT licensed by Naoto Shimazaki
Maintained by [email protected]
This version can be pinned in stack with:bitset-word8-0.1.1.0@sha256:bf1c60aab13cd744019bdc6062f1ceee5ec67a9d9d6578b781c7a0cb3e0d8432,2008

Module documentation for 0.1.1.0

bitset-word8

License: MIT Build Status Hackage Stackage Nightly Stackage LTS

Space efficient set of Word8 and some pre-canned sets useful for parsing HTTP related ByteString. This package is intended to provide O(1) membership test on any subset of ASCII and Latin-1 character set in order to write efficient HTTP related parser.

Creating your own set

You can create your own set by fromList.

myCharSet :: BitSetWord8
myCharSet = fromList [ 'Y', 'y', 'N', 'n' ]

You can create pre-evaluated set using Template Haskell.

{-# LANGUAGE TemplateHaskell #-}
import Language.Haskell.TH.Syntax (Lift, lift)

myPreEvaluatedCharSet :: BitSetWord8
myPreEvaluatedCharSet = $(lift myCharSet)

Example Usage

import Data.Attoparsec.ByteString

-- | Parse RFC7230 token.
token :: Parser ByteString
token = takeWhile1 (member rfc7230TChar)

Changes

Bitset-word8 0.1.1.0

  • Changed backend from ByteString to unboxed Word64 based on benchmark result.
  • Added benchmarks with some backend implementations.

Bitset-word8 0.1.0.1

  • Minor modifications in documents.

Bitset-word8 0.1.0.0

  • Initial release.