haskell / haskell/parsec

Documentation regarding updatePosChar does not match the function's behaviour

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

Description

The documentation claims that:

> If the character is a newline (\'\\n\') or carriage return (\'\\r\') the line number is incremented by 1.

(Specified [here](https://github.com/haskell/parsec/blob/38dfc545874dd44c26382d8dd692eb533396c6f5/src/Text/Parsec/Pos.hs#L108-L110).)

But the actual definition does not do any special handling of `'\r'`, thus leaving it to fall back to the default case behaviour of increasing the column number by 1.

https://github.com/haskell/parsec/blob/38dfc545874dd44c26382d8dd692eb533396c6f5/src/Text/Parsec/Pos.hs#L115-L120

I was initially going to submit a PR rectifying the comment (for which I prepared [a commit](https://github.com/Pharap/parsec/commit/8e4e0be6998d4bf5effc1e4eecbc1415ad40ca21)), but I started wondering whether it's the comment that's wrong (i.e. that `'\t'` isn't supposed to behave that way) or the code itself (i.e. that `'\t'` should be specially handled and it isn't), so I decided to raise an issue first as a precaution.

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.