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

Comply with recent grammar changes #1812

Merged
merged 3 commits into from
May 26, 2020
Merged

Comply with recent grammar changes #1812

merged 3 commits into from
May 26, 2020

Conversation

sjakobi
Copy link
Collaborator

@sjakobi sjakobi commented May 26, 2020


TODO:

  • Update prettyprinter
  • Does the marshalling code need any updates to handle empty labels?

@sjakobi
Copy link
Collaborator Author

sjakobi commented May 26, 2020

[ ] Update prettyprinter

I haven't found anything to change. Here's the URL prettyprinter:

instance Pretty URL where
pretty (URL {..}) =
schemeDoc
<> "://"
<> Pretty.pretty authority
<> pathDoc
<> queryDoc
<> foldMap prettyHeaders headers
where
prettyHeaders h = " using " <> Pretty.pretty h
File {..} = path
Directory {..} = directory
pathDoc =
foldMap prettyURIComponent (reverse components)
<> prettyURIComponent file
schemeDoc = case scheme of
HTTP -> "http"
HTTPS -> "https"
queryDoc = case query of
Nothing -> ""
Just q -> "?" <> Pretty.pretty q
prettyURIComponent :: Text -> Doc ann
prettyURIComponent text =
Pretty.pretty $ URI.normalizeCase $ URI.normalizeEscape $ "/" <> Data.Text.unpack text

@sjakobi
Copy link
Collaborator Author

sjakobi commented May 26, 2020

I believe we'll benefit from the empty labels change in our QuickCheck tests where we previously produced a lot of invalid expressions which contained empty labels.

I'm still wondering whether the same change won't cause a bug in some marshalling/conversion code, but I assume we'll find out when people start using empty labels.

@sjakobi sjakobi marked this pull request as ready for review May 26, 2020 20:51
@sjakobi sjakobi changed the title WIP: Comply with recent grammar changes Comply with recent grammar changes May 26, 2020
@sjakobi sjakobi merged commit 2b2dc37 into master May 26, 2020
@sjakobi sjakobi deleted the sjakobi/parser-updates branch May 26, 2020 20:52
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