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

Make reformat return a ByteString #720

Merged
merged 4 commits into from Apr 30, 2023

Conversation

toku-sa-n
Copy link
Collaborator

@toku-sa-n toku-sa-n commented Apr 30, 2023

Description of the PR

Makes reformat return a ByteString.

In the early days, reformat simply returned the Builder contained in PrintState, therefore it was reasonable for the return type of reformat to be Builder. However, reformat started changing Builder to ByteString once, manipulating it, and then back to Builder again, in order to support prefixes and such. Thus, returning a Builder became not very reasonable, and instead, I thought it would be better to simply return the ByteString since it would be easier for the user to use it.

I am not familiar with the topic of lazy vs strict. The reason why I made reformat return the strict version is that reformat accepts the same type of value as an argument. However, since Builder can only convert to lazy ByteString, perhaps it is more convenient to return the lazy version.

Checklist

In the early days, `reformat` simply returned the `Builder` contained in
`PrintState`, thus it was reasonable for the return type of `reformat`
to be `Builder`. However, `reformat` started changing `Builder` to
`ByteString` once, manipulating it, and then back to `Builder` again, in
order to support prefixes and such. This was not very reasonable, and
instead, I thought it would be better to simply return `ByteString`
since it would be easier for the user to use it.

I am not familiar with the topic of lazy vs strict. The reason why I
made `reformat` return the strict version is that `reformat` accepts the
same type of value as an argument. However, since `Builder` can only
convert to lazy ByteString, perhaps it is more convenient to return the
lazy version.
@toku-sa-n toku-sa-n marked this pull request as ready for review April 30, 2023 04:24
@mihaimaruseac mihaimaruseac merged commit c164bbe into mihaimaruseac:master Apr 30, 2023
17 checks passed
@toku-sa-n toku-sa-n deleted the return-bytestring branch April 30, 2023 14:40
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.

None yet

2 participants