by-other-names: Give aliases to record fields.

[ bsd3, data, library ] [ Propose Tags ]

Give aliases to record fields.

[Skip to Readme]


Maintainer's Corner

Package maintainers

For package maintainers and hackage trustees


  • No Candidates
Versions [RSS],,,,
Change log
Dependencies aeson (>=, base (>= && <5), indexed-traversable (>=0.1.2), template-haskell (>=, text (>= [details]
License BSD-3-Clause
Author Daniel Diaz
Category Data
Source repo head: git clone
Uploaded by DanielDiazCarrete at 2022-12-05T10:02:12Z
Distributions NixOS:
Downloads 148 total (9 in the last 30 days)
Rating (no votes yet) [estimated by Bayesian average]
Your Rating
  • λ
  • λ
  • λ
Status Docs available [build log]
Last success reported on 2022-12-05 [all 1 reports]

Readme for by-other-names-

[back to package description]


Give aliases to record fields.

When generically deriving aeson's `FromJSON` and `ToJSON` instances, field names are used as the keys for the serialized JSON. If you don't want that, another option is to write the instances manually. Problem is, you have to repeat the field names once for FromJSON and once for ToJSON.

I wanted an intermediate solution similar to what is provided by Go's struct tags: associate aliases with each field and use those aliases when serializing/deserializing. There can be different sets of aliases for different contexts (json, orm...). In this library, each of those possible contexts is called a "rubric".

How to depend on this library?

  by-other-names ^>=