Skip to content

Use the strict/lazy type synonyms for better generated documentation - #628

Merged
clyring merged 1 commit into
haskell:masterfrom
MorrowM:use-type-synonyms
Nov 26, 2023
Merged

Use the strict/lazy type synonyms for better generated documentation#628
clyring merged 1 commit into
haskell:masterfrom
MorrowM:use-type-synonyms

Conversation

@MorrowM

@MorrowM MorrowM commented Nov 26, 2023

Copy link
Copy Markdown
Contributor

While using qualified names such as S.ByteString or L.ByteString
allows for GHC to disambiguate between the strict and lazy variants, the
generated haddocks end up being quite confusing, prime examples being
fromStrict and toStrict.

image

This patch replaces such uses with the type synonyms StrictByteString and LazyByteString to (hopefully) make the docs a bit clearer.

image

@Kleidukos

Copy link
Copy Markdown
Member

This indeed looks clearer! I envy the beginner who will learn Haskell with this change. :)

@Bodigrim Bodigrim left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I wonder whether StrictByteString should remain just ByteString, but either way is fine for me.

@Bodigrim
Bodigrim requested a review from clyring November 26, 2023 20:35
@MorrowM

MorrowM commented Nov 26, 2023

Copy link
Copy Markdown
Contributor Author

@Bodigrim The issue with doing that is that fromStrict and toStrict are exported in both Data.ByteString and Data.ByteString.Lazy. Possibly I could leave the doc comment as how it was, though.

@clyring clyring left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Fantastic! I've wanted to do this for some time but never got around to it. I have a couple of very minor formatting questions/suggestions.

Thanks for doing this!

Comment thread Data/ByteString/Builder/Internal.hs Outdated
Comment thread Data/ByteString/Builder/Internal.hs Outdated
Comment thread Data/ByteString/Builder/Internal.hs Outdated
Comment thread Data/ByteString/Builder/Internal.hs Outdated
Comment thread Data/ByteString/Builder/Internal.hs Outdated
Comment thread Data/ByteString/Builder/Internal.hs Outdated
Comment thread Data/ByteString/Builder/Internal.hs Outdated
Comment thread Data/ByteString/Builder/Internal.hs Outdated
Comment thread Data/ByteString/Lazy.hs Outdated
Comment thread Data/ByteString/Lazy/Internal/Deque.hs
Replace confusing occurrences of strict/lazy ByteString in
generated documentation with the corresponding type
synonyms.
@MorrowM

MorrowM commented Nov 26, 2023

Copy link
Copy Markdown
Contributor Author

@clyring Thanks for the catches, I think I've fixed them all.

@clyring clyring left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks!

@clyring
clyring merged commit 7e11412 into haskell:master Nov 26, 2023
@clyring clyring added this to the 0.12.1.0 milestone Jan 30, 2024
clyring pushed a commit that referenced this pull request Jan 30, 2024
Replace confusing occurrences of strict/lazy ByteString in
generated documentation with the corresponding type
synonyms.

(cherry picked from commit 7e11412)
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.

4 participants