-
Notifications
You must be signed in to change notification settings - Fork 297
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
Refactor [] to NonEmpty in Quasi module #1193
Refactor [] to NonEmpty in Quasi module #1193
Conversation
I've fixed CI, mind rebasing and trying again? |
|
||
preparse :: Text -> [Line] | ||
preparse :: Text -> Maybe (NonEmpty Line) |
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.
Maybe (NonEmpty a)
is equivalent to [a]
. What's the purpose of this change?
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.
Well its just so that parseLines
can take a NonEmpty
value, but it might make sense to make that call to nonEmpty
within parse
actually and then leave preparse
alone.
I guess alternatively though you could say preparse
can potentially fail to return anything of interest, and thus that is represented as a Nothing
value here. You can say the same thing about parse
as well, though obviously that needs to remain as []
.
I'm happy to move nonEmpty
directly into parse
though if that makes more sense 👍
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 think I'm just not sure about the benefit of this particular [] -> NonEmpty
change. We don't appear to have any behavior that assumes or depends on []
being non-empty somewhere with this set of code.
But, it's also not a breaking change, and it seems like it makes sense semantically in the parsing section 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.
Thanks! 😄
|
||
preparse :: Text -> [Line] | ||
preparse :: Text -> Maybe (NonEmpty Line) |
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 think I'm just not sure about the benefit of this particular [] -> NonEmpty
change. We don't appear to have any behavior that assumes or depends on []
being non-empty somewhere with this set of code.
But, it's also not a breaking change, and it seems like it makes sense semantically in the parsing section here.
Since this is a refactoring-only change, isn't exposed to the public interface, and is covered entirely by the tests, I'm going to merge without requiring a changelong entry. If you want to put a changelog entry in for the sweet sweet credit, feel free to push it up. I'll merge this sometime in the next few days. Thanks! |
A refactoring contribution towards #1061