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

Issue with parsing non-nullable types #221

Open
fredefox opened this issue Aug 2, 2019 · 0 comments · May be fixed by #222
Open

Issue with parsing non-nullable types #221

fredefox opened this issue Aug 2, 2019 · 0 comments · May be fixed by #222

Comments

@fredefox
Copy link

fredefox commented Aug 2, 2019

There is a bug that prevents a document such as

input B {
  b: [B!]!
}

from parsing.

Note the difference between:

λ length <$> parseOnly (many1 inputValueDefinition) "b: [B!]! x: B"
Right 1
λ length <$> parseOnly (many1 inputValueDefinition) "b: [B!] x: B"
Right 2

And similarly for

λ length <$> parseOnly (many1 fieldDefinition) "b: [B!] b: B"
Right 2
λ length <$> parseOnly (many1 fieldDefinition) "b: [B!]! b: B"
Right 1

Related to this I want to ask about the definition of NonNullType. Wouldn't it make more sense to define NonNullType to be:

newtype NonNullType = NonNullType GType

Of course this will permit parsing something like A!!! - but I believe it would simplify some of the code and help fix the bug in the parser. One challenge with that approach, though, is that parsing a type declaration will then require a look-ahead. Does the declaration end with an exclamation mark or not.

@fredefox fredefox changed the title Input value parser fails Issue with parsing non-nullable types Aug 2, 2019
@fredefox fredefox linked a pull request Aug 7, 2019 that will close this issue
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

Successfully merging a pull request may close this issue.

1 participant