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

LTS Haskell 22.29:
Stackage Nightly 2024-07-20:
Latest on Hackage:

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-,2361

Module documentation for

Used by 1 package in nightly-2024-04-22(full list with versions):


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)



  • Include .cabal file in source repo.
  • Migrate CI from Travis to GitHub Actions.
  • Build and test for multiple platforms and GHC versions.


  • Move to hpack from hand written cabal project file.


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


  • Minor modifications in documents.


  • Initial release.