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

Allow aeson 2.0 #2315

Merged
merged 3 commits into from
Nov 2, 2021
Merged

Allow aeson 2.0 #2315

merged 3 commits into from
Nov 2, 2021

Conversation

@Gabriella439
Copy link
Collaborator

I wasn't sure if this is safe to merge or if we're still waiting on upstream to fix their bounds before we can test this

@sjakobi
Copy link
Collaborator Author

sjakobi commented Oct 19, 2021

@Gabriel439 I think we'll need to wait at least for informatikr/aeson-pretty#36 in order to build dhall with aeson-2.

@hasufell
Copy link

aeson-pretty is abandoned (there was a reddit thread asking for package takeover)

@sjakobi
Copy link
Collaborator Author

sjakobi commented Oct 19, 2021

Yeah, I saw the reddit thread at https://www.reddit.com/r/haskell/comments/qape11/aesonpretty_request_for_new_maintainer/.

Seems like u/callbyneed is stepping up as a maintainer, so I'm optimistic for now.

Copy link
Collaborator

@Gabriella439 Gabriella439 left a comment

Choose a reason for hiding this comment

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

Feel free to merge this whenever you're ready

@sjakobi
Copy link
Collaborator Author

sjakobi commented Oct 26, 2021

I'm running into a weird issue with a compat change in Dhall.JSON. When I add {-# LANGUAGE CPP #-} to the top of the file, I get the following parse error from GHC:

src/Dhall/JSON.hs:272:204: error:
    lexical error in string/character literal at character 'E'
    |
272 |             _ERROR <> ": ❰None❱ is not valid on its own                                      \n\
    |                                                                                                                                                                                                            ^

I've tested with GHC 8.6.5, 8.8.4, 8.10.7 and 9.0.1. This looks like a bug in GHC or the C-preprocessor, right?!

EDIT: If I add the pragma to Dhall.TypeCheck, I get a similar error.

@sjakobi sjakobi force-pushed the aeson-2 branch 2 times, most recently from ba06435 to 8755bfc Compare October 26, 2021 17:00
@sjakobi
Copy link
Collaborator Author

sjakobi commented Oct 26, 2021

I'm running into a weird issue with a compat change in Dhall.JSON.

I worked around that issue by keeping the CPP in a new module Dhall.JSON.Compat.

https://hackage.haskell.org/package/aeson-2.0.0.0/changelog

The one exception is `dhall-lsp-server` where the deprecated
`haskell-lsp` dependency is unlikely to gain compatibility with
aeson >= 2. See #2270.
@sjakobi sjakobi marked this pull request as ready for review October 26, 2021 17:11
@sjakobi
Copy link
Collaborator Author

sjakobi commented Oct 26, 2021

I have reverted the bounds bump in dhall-lsp-server. I think we'll need to address #2270 before we can make that package compatible with aeson-2.

Since I've pushed some code changes, could you do a quick review, @Gabriel439?

@sjakobi
Copy link
Collaborator Author

sjakobi commented Oct 26, 2021

I'm running into a weird issue with a compat change in Dhall.JSON. When I add {-# LANGUAGE CPP #-} to the top of the file, I get the following parse error from GHC:

I seem to have hit https://gitlab.haskell.org/ghc/ghc/-/issues/10230.

If this keeps bugging us, we could probably start using QuasiQuotes / neat-interpolation again. I think that would be more readable and maintainable too.

The original motivation for avoiding QQ seems to have been dhall-lang/dhall-json#12 / ghcjs/ghcjs#617, which seems to have been fixed upstream.

@Gabriella439
Copy link
Collaborator

@sjakobi: Yeah, I would be fine restoring the use of QuasiQuotes. Also, we should try using string-interpolate instead of neat-interpolation because the string-interpolate package is a little bit more featureful

@hasufell
Copy link

string-interpolate increases compile times noticeably, I think due to haskell-src-* packages.

@sjakobi
Copy link
Collaborator Author

sjakobi commented Oct 29, 2021

we should try using string-interpolate instead of neat-interpolation because the string-interpolate package is a little bit more featureful

What features are you looking for? Note that neat-interpolation has gained an untrimming variant, although the precise difference to trimming / text is not quite clear to me.

@Gabriella439
Copy link
Collaborator

The main feature of string-interpolate that appeals to me is that you can interpolate arbitrary Haskell expressions (instead of just variables)

@hasufell
Copy link

hasufell commented Oct 30, 2021

Maybe consider https://discourse.haskell.org/t/pyf-0-10-0-1-format-multi-lines-string/3540/2 which doesn't use haskell-src-ext anymore.

Prelude PyF> putStrLn [fmt|{take 2 ['c','b','d']}|]
cb

@sjakobi
Copy link
Collaborator Author

sjakobi commented Nov 1, 2021

@hasufell PyF looks interesting! Does it support un-indenting multiline strings, like neat-interpolation?

@hasufell
Copy link

hasufell commented Nov 1, 2021

@sjakobi I'm not sure, the only thing about multi-line strings in the README is here: https://github.com/guibou/PyF#multi-line-strings

@sjakobi sjakobi merged commit becb446 into master Nov 2, 2021
@sjakobi sjakobi deleted the aeson-2 branch November 2, 2021 17:45
@sjakobi
Copy link
Collaborator Author

sjakobi commented Nov 7, 2021

While the update to dhall-json includes code changes, I realized that for dhall, dhall-yaml, dhall-nixpkgs and dhall-openapi, Hackage revisions would be sufficient, so I've published these.

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.

3 participants