-
Notifications
You must be signed in to change notification settings - Fork 61
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
Fix parsing of spaces in targets ghci-scripts #163
Conversation
da1e7ee
to
7caf542
Compare
7caf542
to
c5ca861
Compare
c5ca861
to
e4eb383
Compare
e4eb383
to
43366ee
Compare
$ 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 |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
Thanks, left comments but an improvement anyway. |
fixes #162