haskell / haskell/attoparsec

Question: scan does not fail with not enough input

Open
#235 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Haskell
Stars
531
Forks
98
PR merge metrics
No merged PRs in 30d

Description

Hi,

EDIT: I can't read, the documentation says scan never fails. If someone reads this and can give me a hint how
I archive the desired behavior anyway it would still make me happy. (I put a Question: in the title to not confuse other humans)

Before I give a description I should say that I use the `Data.Attoparsec.ByteString.Lazy` variants. (But I doubt that matters)
If I run
```
> testparser1 = manyTill anyWord8 (string ">")
> parse testparser1 "HALLO"
```
I get the expected behavior `Fail "" [] "not enough input"`.
But if I run
```
> testparser2 = scan () (\_ w -> if (w == B.head ">") then Nothing else Just ())
> parse testparser2 "HALLO"
```
The parser returns `Done "" "HALLO"` instead. I expect it to fail with a similar error as testparser1.
All the best,
nerf

post scriptum: The code requires OverloadedStrings

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.