by-other-names-1.2.3.0: Give aliases to record fields.
Safe HaskellSafe-Inferred
LanguageHaskell2010

ByOtherNames.TH

Description

This module provides a quasiquoter which makes it a bit easier to define lists of textual aliases.

>>> :{
data Foo = Foo {xa :: Int, xb :: Bool, xc :: Char, xd :: String, xe :: Int}
           deriving stock (Read, Show, Eq, Generic)
           deriving (FromJSON, ToJSON) via (JSONRecord "obj" Foo)
instance Aliased JSON Foo where
  aliases = [aliasList| 
     xa = "aax",
     xb = "bbx",
     xc = "ccx",
     xd = "ddx",
     xe = "eex",
   |]
:}

Documentation