-
Notifications
You must be signed in to change notification settings - Fork 322
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
Migration guide 1.5 -> 2.0 #881
Comments
it's a changelog, not a migration guide. You can contribute your observations here. You can pick ideas from In summary, change |
Here is one more: agda/agda@8037346 |
So essentially the official advice is "good luck"? That's disappointing. Here's my summary of the changes and what you'll need to do to support them:
|
While I do strongly agree with the sentiment of "let's not bash people doing free labour", I'd also like to express thanks to @tfausak for the write-up. This was not expressible in a clear way with emojis, so I wrote a comment instead. |
Here's my diff for jose: frasertweedale/hs-jose@ffc0cde Apart from updating |
So it might be worth extending the |
@googleson78 not necessarily. How to filter efficiently can depend on the underlying representation (e.g. if you want to keep/drop keys in an existing |
Closes: #991 Upstream quarrel: haskell/aeson#881
Closes: #991 Upstream quarrel: haskell/aeson#881
Details: haskell/aeson#881
I would like to note that a possible way to make the code work across bot -addNullField :: Text -> Value -> Value
-addNullField s (Object o) = Object $ HM.insertWith (\_new old -> old) s Null o
+addNullField :: String -> Value -> Value
+addNullField s (Object o) = Object $ o <> fromString s .= Null
- A.Object $
- HMap.adjust
- ( \(unsafeValueToObject -> o) ->
- A.Object $ HMap.insert "plugin" elems o -- inplace the "plugin" section with our 'elems', leaving others unchanged
- )
- "haskell"
- (unsafeValueToObject (A.toJSON defaultConfig))
+ -- Use 'ix' to look at all the "haskell" keys in the outer value (since we're not
+ -- setting it if missing), then we use '_Object' and 'at' to get at the "plugin" key
+ -- and actually set it.
+ A.toJSON defaultConfig & ix "haskell" . _Object . at "plugin" ?~ elems Another example: - "changes" `HM.member` editParams @? "Contains changes"
- not ("documentChanges" `HM.member` editParams) @? "Doesn't contain documentChanges"
+ (editParams & has (ix "changes")) @? "Contains changes"
+ not (editParams & has (ix "documentChanges")) @? "Doesn't contain documentChanges" |
@jneira except we'll probably change (or break if you prefer that term) EDIT: that example will work as |
Well at least we have a lens-aeson bridge version with support for pre and post 2.0, so we can leverage it to avoid cpp in client code for now (with a little bit of luck cpp will not needed later :-) ) |
- Sized Word/Int changes: https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.2#sized-wordint-use-sized-wordint-primitives - Aeson 2's KeyMap/Key types are new: haskell/aeson#881 (comment)
@phadej from my perpective, the changelog is a perfectly fine place to put a migration guide along with the changes. Let me emphasize that I don't exptect you to do the work of writing it. If someone else did the work, would you accept it into the changelog, or is there another place where you would find it more suitable? |
- Sized Word/Int changes: https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.2#sized-wordint-use-sized-wordint-primitives - Aeson 2's KeyMap/Key types are new: haskell/aeson#881 (comment)
- Sized Word/Int changes: https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.2#sized-wordint-use-sized-wordint-primitives - Aeson 2's KeyMap/Key types are new: haskell/aeson#881 (comment)
- Sized Word/Int changes: https://gitlab.haskell.org/ghc/ghc/-/wikis/migration/9.2#sized-wordint-use-sized-wordint-primitives - Aeson 2's KeyMap/Key types are new: haskell/aeson#881 (comment)
aeson-2 switched to use KeyMap interface instead of HashMap. Fix haskell/aeson#881
aeson-2 switched to use KeyMap interface instead of HashMap. Some inpiration from haskell/aeson#881 Fix monadfix#17
I'd just like to point out that many of the excellent suggestions provided here by @tfausak and others are in fact directed towards developers interested in building in both aeson-1 and aeson-2 environments. If you just want to migrate from 1.x to 2.x, like the title of this issue suggests, it is much easier. Switching out |
The changelog isn't explicit about how to migrate from
aeson-1.5
to-2.0
.Please add a migration guide with the most common fixes needed.
The text was updated successfully, but these errors were encountered: