| CARVIEW |
Select Language
HTTP/1.1 200 OK
Connection: keep-alive
Server: nginx/1.24.0 (Ubuntu)
Content-Type: text/html; charset=utf-8
Cache-Control: public, max-age=300
Content-Encoding: gzip
Via: 1.1 varnish, 1.1 varnish
Accept-Ranges: bytes
Age: 0
Date: Sat, 17 Jan 2026 01:29:17 GMT
X-Served-By: cache-dfw-kdal2120131-DFW, cache-bom-vanm7210035-BOM
X-Cache: MISS, MISS
X-Cache-Hits: 0, 0
X-Timer: S1768613357.210073,VS0,VE298
Vary: Accept, Accept-Encoding
transfer-encoding: chunked
snack: Strict ByteString Parser Combinator
snack: Strict ByteString Parser Combinator
Downloads
- snack-0.4.0.0.tar.gz [browse] (Cabal source package)
- Package description (as included in the package)
Maintainer's Corner
For package maintainers and hackage trustees
Candidates
- No Candidates
| Versions [RSS] | 0.1.0.0, 0.2.0.0, 0.3.0.0, 0.4.0.0 |
|---|---|
| Change log | Changelog.md |
| Dependencies | base (>=4.13 && <5), bytestring (>=0.10.12), bytestring-lexing (>=0.5), text (>=2.0) [details] |
| Tested with | ghc ==9.2.1 |
| License | CC0-1.0 |
| Copyright | Jan Hamal Dvořák |
| Author | Jan Hamal Dvořák |
| Maintainer | mordae@anilinux.org |
| Uploaded | by mordae at 2022-07-16T14:29:05Z |
| Category | Text, Parsing |
| Home page | https://github.com/mordae/snack#readme |
| Bug tracker | https://github.com/mordae/snack/issues |
| Source repo | head: git clone https://github.com/mordae/snack.git |
| Distributions | |
| Downloads | 314 total (12 in the last 30 days) |
| Rating | (no votes yet) [estimated by Bayesian average] |
| Your Rating |
|
| Status | Docs available [build log] Last success reported on 2022-07-16 [all 1 reports] |
Readme for snack-0.4.0.0
[back to package description]snack
Strict ByteString Parser Combinator
- Simple. Feel free to contribute.
- Fast. Sometimes faster then Attoparsec.
- ASCII. Good enough for IETF formats.
- Also Text. But quite slower.
Example:
import Data.ByteString (ByteString)
import qualified Data.ByteString.Parser.Char8 as BSP
parseList :: BSP.Parser [ByteString]
parseList = (token `BSP.wrap` BSP.skipSpace) `BSP.sepBy` BSP.char ','
where token = BSP.takeWhile isToken
isToken c = inRange 'a' 'z' c ||
inRange 'A' 'Z' c ||
inRange '0' '9' c ||
c == '_' || c == '-'
main :: IO ()
main = do
putStrLn $ show $ BSP.runParser parseList "monkey, wrench, bananas"
putStrLn $ show $ BSP.runParser parseList "^quux"
putStrLn $ show $ BSP.runParser (parseList <* BSP.endOfInput) "^quux"
-- Will output:
-- Success ["monkey","wrench","bananas"] ""
-- Success [""] "^quux"
-- Failure ["end of input"] "^quux"