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

Call for Examples #4

Open
BebeSparkelSparkel opened this issue Mar 5, 2020 · 6 comments
Open

Call for Examples #4

BebeSparkelSparkel opened this issue Mar 5, 2020 · 6 comments

Comments

@BebeSparkelSparkel
Copy link
Owner

Please put in some input result tests for your biparsing needs.

Just add them to tests and try to explain yourself as best as possible.

@masaeedu
Copy link
Collaborator

masaeedu commented Mar 9, 2020

@BebeSparkelSparkel I was looking at your DXF example and noticed something. You don't capture the whitespace for the integer lines in the parsed representation. When printing, how much leading whitespace should the numbers be padded with?

@masaeedu
Copy link
Collaborator

masaeedu commented Mar 9, 2020

The interesting thing is that I was trying to use the many combinator to parse out the whitespace, but the types simply wouldn't let me.

@BebeSparkelSparkel
Copy link
Owner Author

@masaeedu
Whitespace of the integer lines has always been the same. It seems like we should be able to choose if we want to conserve whitespace or not because it may or may not be important, because it could be a lot of overhead to deal with and it could be hard to optimize speed and space.

For many, I put in the biMany in there but it would be cool to allow the parser combinators like many.

@masaeedu
Copy link
Collaborator

masaeedu commented Mar 9, 2020

@BebeSparkelSparkel What I mean regarding the many thing is that while snd <$> many space /\ nat makes for a fine parser of lines that have some leading whitespace and then a natural number, it doesn't actually work as a biparser. Specifically, if all you're parsing out is a natural number, you have no idea how much space to pad it with when you're printing it back out (unless this number is fixed somehow, or you hang on to the whitespace in the parsed representation).

@masaeedu
Copy link
Collaborator

masaeedu commented Mar 9, 2020

Regarding:

Whitespace of the integer lines has always been the same.

I see a few lines in there where the leading whitespace is different. For example you have two spaces in " 9" but one space in " 70" and none in "160".

If the rule here is that the number lines are always exactly three characters, that works, but we need some kind of rule so that when you're printing out your number you know what to do.

@BebeSparkelSparkel
Copy link
Owner Author

Sorry, you are correct. It is always a 3 digit number with whitespace if there is no digit there.

I was thinking there could be some biparser constructor that is sort of like prism

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