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

[ concurrency, library, mit ] [ Propose Tags ]

Please see the README on GitHub at https://github.com/nshimaza/bitset-word8#readme


[Skip to Readme]
Versions [faq] 0.1.0.0, 0.1.0.1, 0.1.1.0, 0.1.1.1
Change log ChangeLog.md
Dependencies base (>=4.7 && <5), containers, template-haskell, th-lift-instances [details]
License MIT
Copyright 2017,2018 Naoto Shimazaki
Author Naoto Shimazaki
Maintainer Naoto.Shimazaki@gmail.com
Category Concurrency
Home page https://github.com/nshimaza/bitset-word8#readme
Bug tracker https://github.com/nshimaza/bitset-word8/issues
Source repo head: git clone https://github.com/nshimaza/bitset-word8
Uploaded by nshimaza at Sun Dec 23 09:36:28 UTC 2018
Distributions LTSHaskell:0.1.1.1, NixOS:0.1.1.1, Stackage:0.1.1.1
Downloads 1041 total (102 in the last 30 days)
Rating (no votes yet) [estimated by rule of succession]
Your Rating
  • λ
  • λ
  • λ
Status Hackage Matrix CI
Docs available [build log]
Last success reported on 2018-12-23 [all 1 reports]

Modules

[Index] [Quick Jump]

Downloads

Maintainer's Corner

For package maintainers and hackage trustees


Readme for bitset-word8-0.1.1.1

[back to package description]

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)