Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Parsec.Expr Example Broken? #38

Open
Chobbes opened this issue May 21, 2015 · 3 comments
Open

Parsec.Expr Example Broken? #38

Chobbes opened this issue May 21, 2015 · 3 comments

Comments

@Chobbes
Copy link

Chobbes commented May 21, 2015

Hi!

I'm a wee baby Haskell programmer, but I noticed that the example at the bottom here:

https://hackage.haskell.org/package/parsec-3.1.9/docs/Text-Parsec-Expr.html

Doesn't seem to type check. I don't think the types of parens / reservedOp are agreeing here. Perhaps they changed?

https://hackage.haskell.org/package/parsec-3.1.9/docs/Text-Parsec-Token.html#v:reservedOp

Perhaps the example needs an update, or more clarification?

Thanks!

@albertnetymk
Copy link

It looks cool to me.

reservedOp :: String -> ParsecT s u m ()

and

prefix  name fun       = Prefix (do{ reservedOp name; return fun }) -- name :: String

are consistent with each other.

@Chobbes
Copy link
Author

Chobbes commented Aug 21, 2015

reservedOp :: GenTokenParser s u m -> String -> ParsecT s u m ()

since it's actually in a record. I'm guessing that this example assumes you have gone through and done some...

import Text.Parsec.Token as T

reservedOp = T.reservedOp myTokenParser

which is fine, but it's a bit confusing in this example since if you are just looking at the libraries for the first time you would assume that reservedOp meant the function defined in the library in the first place.

@albertnetymk
Copy link

@Chobbes OK, I got your point. I guess this could be OP's doubt as well.

This repo is not so active, I think. Alternatively, if you are interested, https://github.com/mrkkrp/megaparsec

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants