The bitset-word8 package

This is a package candidate release! Here you can preview how this package release will appear once published to the main package index (which can be accomplished via the 'maintain' link below). Please note that once a package has been published to the main package index it cannot be undone! Please consult the package uploading documentation for more information.

[maintain]

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.


[Skip to ReadMe]

Properties

Versions0.1.0.0, 0.1.0.1, 0.1.0.1
Change logCHANGELOG.md
Dependenciesbase (>=4.7 && <5), bytestring, containers, template-haskell, th-lift-instances [details]
LicenseMIT
CopyrightCopyright: (c) 2017 Naoto Shimazaki
AuthorNaoto Shimazaki
MaintainerNaoto.Shimazaki@gmail.com
CategoryData
Home pagehttps://github.com/nshimaza/bitset-word8#readme
Source repositoryhead: git clone https://github.com/nshimaza/bitset-word8
UploadedThu Oct 5 07:30:17 UTC 2017 by nshimaza

Modules

[Index]

Downloads

Maintainers' corner

For package maintainers and hackage trustees


Readme for bitset-word8-0.1.0.1

[back to package description]

bitset-word8

License: MIT Build Status Hackage

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)