Open
Conversation
aeson 2.0 replaced HashMap-based Object with KeyMap-based Object. This updates all HashMap operations to use the KeyMap and Key APIs: - H.lookup -> KM.lookup with AK.fromText for key conversion - Object type alias -> KM.KeyMap A.Value - .: and .:? operators now use AK.fromText for string keys - Object construction uses AK.fromText for keys - emptyObject replaced with A.Object KM.empty - MethodMap type updated from HashMap to KeyMap - Dependency bounds updated: aeson >=2.0, removed unordered-containers - Relaxed upper bounds for base, bytestring, text, vector, deepseq, mtl Fixes sebright#3 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Data.Aeson.KeyMap no longer exports adjust in aeson 2.2.x. Replace with KM.lookup + KM.insert pattern.
Previously, parseArg used A.fromJSON which discards the JSONPath accumulated by (.:) and withObject, producing bare error strings like "expected Number, got String". Switch to iparse/IResult/formatError so that the full path is included in the error: "Error in $.products[0].price: expected Number, got String". This makes JSON-RPC -32602 errors actionable without guessing which field caused the failure.
Owner
|
Thank you for making this PR. I already merged #3, because it supports more versions of aeson, but I could merge the JSONPath change if you want to rebase the last commit (and only give a better error message for newer versions of aeson). |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Migrates from
Data.HashMap.StricttoData.Aeson.Key/Data.Aeson.KeyMapfor compatibility with aeson 2.0+.Changes
import qualified Data.HashMap.Strict as HwithData.Aeson.KeyandData.Aeson.KeyMapimportsArgstype alias fromA.ObjecttoKM.KeyMap A.ValueH.lookupcalls toKM.lookupwithAK.fromTextkey wrapping.:,.:?, and.=operators to useAK.fromTextfor text keysemptyObjectwithA.Object KM.emptyMethodMaptype fromH.HashMap TexttoKM.KeyMapunordered-containersdependency (no longer needed)base,bytestring,text,vector,deepseq,mtlaeson >=2.0 && <2.3Fixes #3
Generated with Claude Code