Skip to content

Aeson 1.5-2.0 compat #9

Open
Open
@tomjaguarpaw

Description

@tomjaguarpaw

Here is a suggestion for an Aeson 1.5-2.0 compatibilty story. The technique is simple: take Aeson 2.0 and change the version 2 abstract types to type synonyms as below (plus chasing up the ensuing, minor, type errors).

This backports the 2.0 API to 1.5, and ought to allow Aeson users to write code that works at the same time against version 1.5 and version 2.0, providing a smooth upgrade path and avoiding the need for a "big bang" switch of the entire Aeson ecosystem at once.

-newtype Key = Key { unKey :: Text }
+type Key = Text

-newtype KeyMap v = KeyMap { unKeyMap :: Map Key v }
+type KeyMap v = Map Key v

I don't actually use Aeson myself, so I would welcome the input of Aeson users and maintainers (esp. @bergmark) regarding

  1. whether this is actually useful, and if so
  2. whether I've got everything correct (the tests pass)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions