bos/attoparsec — pull request #14 by tibbe (2012-04-11 21:31:28+00:00)
Title: Add peekWord8/peekChar

While these new functions don't allow you to express something new, they make it more efficient (and perhaps more natural) to express committed choice. For example, if you want to parse a CSV field, which may be surrounded by double quotes, you can now do:

```haskell
field = do
mb <- peekWord8
case mb of
Just b | b == doubleQuote -> quotedField
_ -> regularField
```

Using `quotedField <|> regularField` would be incorrect as once we've seen the initial double quote, we want to commit to the `quotedField` path. You could achieve the same effect by using `word8`, but then you'd be forced to cons the byte back onto the string in the `regularField` case, causing an extra copy.