Fix for GHC 9.2 / template-haskell-2.18#1338
Fix for GHC 9.2 / template-haskell-2.18#1338brandon-leapyear wants to merge 7 commits intoyesodweb:masterfrom brandon-leapyear:chinn/aeson2
Conversation
| # When the following PRs are merged, add a source-repository-package | ||
| # stanza in cabal.project for them. | ||
| # * https://github.com/yesodweb/shakespeare/pull/260 | ||
| # * https://github.com/DanBurton/haskell-src-meta/pull/23 | ||
| # * https://github.com/haskell-foundation/foundation/pull/555 | ||
| # * https://github.com/vincenthz/hs-memory/pull/87 | ||
| # * https://github.com/haskell-crypto/cryptonite/pull/354 | ||
| # - "9.2" |
There was a problem hiding this comment.
Cabal doesn't support this like Stack does: haskell/cabal#7821. I don't want to specify the forked repos in cabal.project, though, because when these PRs are merged, the forked repos could be deleted
I've tested this manually with stack build --test --no-run-tests --bench --no-run-benchmarks and it builds
|
I'm getting a test failure on this branch with |
|
✨ _**This is an old work account. Please reference @brandonchinn178 for all future communication**_ ✨
<!-- updated by mention_personal_account_in_comments.py -->
…---
Is it reproducible on master? Doesnt look related to these changes
On Sun, Nov 28, 2021, 5:41 PM hololeap ***@***.***> wrote:
I'm getting a test failure on this branch with ghc-9.2.1 and aeson-2.0.2.0
:
Failures:
test/Database/Persist/ClassSpec.hs:14:21:
1) Database.Persist.Class.PersistField.UTCTime fromPersistValue with format
expected: Right 2018-02-27 10:49:42.123 UTC
but got: Right 2018-02-27 10:49:42 UTC
To rerun use: --match "/Database/Persist/Class/PersistField/UTCTime/fromPersistValue with format/"
Randomized with seed 947093686
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1338 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AGUC75IK62CYLTCTLE5SR4DUOLK43ANCNFSM5ICH2UOA>
.
|
|
It's hard to know because |
|
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨ Seems like ghc-9.2.1 is bundled with Updated the code and tested that the test now passes. |
| case parse8601 s <|> parsePretty s of | ||
| Nothing -> Left $ fromPersistValueParseError "UTCTime" x | ||
| Just x' -> Right x' | ||
| matches -> Right $ fst $ last matches |
There was a problem hiding this comment.
Leafing through this PR, this was the only change that stuck out as not obvious.
- Why switch from first match to last match?
- Could this application of
lastbe made statically error-free by usingData.List.NonEmpty.last?
I'd say a comment in the code, justifying the choice of last match, would be in order.
There was a problem hiding this comment.
Yeah, I mentioned this in the commit message, but the new time package bundled with GHC 9.2 changed the Read UTCTime instance to be more forgiving and provide partial matches.
-- old time
>>> reads "2018-02-27 10:49:42.12 UTC" :: [(UTCTime, String)]
[(2018-02-27 10:49:42.12 UTC,"")]
-- new time
>>> reads "2018-02-27 10:49:42.12" :: [(UTCTime, String)]
[(2018-02-27 10:49:42 UTC,"12"),(2018-02-27 10:49:42.1 UTC,"2"),(2018-02-27 10:49:42.12 UTC,"")]I'll add a comment and use NonEmpty
|
This can be rebased now since the aeson 2 changes were merged separately. |
|
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨ @bergmark thanks! Done |
| - github: haskell-foundation/foundation | ||
| commit: 0bb195e1fea06d144dafc5af9a0ff79af0a5f4a0 | ||
| subdirs: | ||
| - basement | ||
| # https://github.com/vincenthz/hs-memory/pull/87 | ||
| - github: vincenthz/hs-memory | ||
| commit: 3cf661a8a9a8ac028df77daa88e8d65c55a3347a | ||
| # https://github.com/haskell-crypto/cryptonite/pull/354 | ||
| - github: haskell-crypto/cryptonite | ||
| commit: 3b081e3ad027b0550fc87f171dffecbb20dedafe |
There was a problem hiding this comment.
This is unfortunate. I wonder if we can drop these dependencies...
There was a problem hiding this comment.
It seems like commenting out persistent-redis and persistent-mongoDB from stack.yaml builds without these dependencies, but I can't figure out how those libraries use these libraries
There was a problem hiding this comment.
using stack dot --external and grepping the file, looks like persistent-mongoDB depends on mongoDB depends on bson depends on cryptohash-md5 depends on crpyothash depends on cryptonite.
There was a problem hiding this comment.
Ah and persistent-redis depends on hedis which depends on tls which depends on cryptonite
Maybe those two should be broken out into a separate repo?
There was a problem hiding this comment.
Oh, no, it's mongoDB -> cryptohash -> cryptonite. cryptohash-md5 appears to be factored out to avoid that dependency entirely, but mongoDB appears to use hmac and sha1 as well
There was a problem hiding this comment.
There is cryptohash-sha1. And there is crypto-api which is maintained by @TomMD , I think.
|
Closing from #1367 - thanks for the contribution! ❤️ |
✨ This is an old work account. Please reference @brandonchinn178 for all future communication ✨
Forked off of #1335 to fix
Database.Persist.THerrors and CI errors. Feel free to merge this back into the other PR