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

Fix parsing of spaces in targets ghci-scripts #163

Merged
merged 4 commits into from
Mar 24, 2020

Conversation

fendor
Copy link
Collaborator

@fendor fendor commented Mar 17, 2020

fixes #162

@fendor fendor requested a review from jneira March 17, 2020 16:44
@fendor fendor force-pushed the issue162/parse-space-in-target branch from da1e7ee to 7caf542 Compare March 17, 2020 17:07
@fendor fendor force-pushed the issue162/parse-space-in-target branch from e4eb383 to 43366ee Compare March 17, 2020 17:23
@fendor fendor requested a review from mpickering March 17, 2020 18:16
src/HIE/Bios/Environment.hs Outdated Show resolved Hide resolved
$ concatMap (tail {- first element is ":add" which we want to remove -}
. words)
$ filter (":add" `isPrefixOf`) contents
let parseGhciLine = concatMap fst . filter (null . snd) . readP_to_S parser
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it perhaps be an error if the parse fails?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I dont think so, since an example ghci-script from stack looks like:

:add A B
:module + B

We only want to successfully parse the first line.
However, we could fail only for lines beginning with :add.

value = many1 (satisfy (not . isSpace))

anyToken :: ReadP Char
anyToken = satisfy $ const True
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pretty sure that not all tokens are valid here.

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True, only those that are valid in module names. But I dont think we want to validate these module names here and when attempting to load, we crash anyways.
But we can change it.

@mpickering
Copy link
Collaborator

Thanks, left comments but an improvement anyway.

@mpickering mpickering merged commit 15d855c into haskell:master Mar 24, 2020
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 this pull request may close these issues.

Ghci Script Target parses space in Filepath with space
3 participants