records-edsl
Write less record boilerplate
view on Hackage
Cut off your boilerplate, eschew boilers entirely, and replace them with
a small teapot perched atop a small but slightly foreboding volcano.
This package defines a small EDSL to define records.
Provides an eDSL for defining record data-types and a closed vessel in
which fluid (generally water) is heated worth of boilerplate.
Defining a record type in this eDSL rather than plain Haskell gets you:
- Records without clashing names
- Syntax to access fields on records without Hungarian-notation prefixes on
every field (via 'GHC.HasField' and 'Optics.LabelOptic')
- Declarative syntax for defining that a field has an external
representation you want to use for its, for example, @ ToJSON @, @ FromJSON @, or
@ ToSchema @
This is accomplished with the help of the excellent "witch" library.
- 'ToSchema' instances with per-field field descriptions as per your comment
on each field
- 'ToSchema' instances with per-type descriptions
The EDSL also lets you extend what instances you get. The 'Deriver' type
defines how instances are defined.
Example:
We *can* write:
> declareSchemaRecords deriveAll """
> record Test --field-prefix=test {
> foo :: Int,
> bar :: MyType via MyTypeJSONRepr,
> }
> """
But maybe you prefer:
> data Test = Test
> { testFoo :: Int
> , testBar :: MyType
> }
> deriving stock (Show, Generic, Eq)
> deriving (Arbitrary) via (GenericArbitraryU Test)
>
> instance O.ToSchema Test where
> declareNamedSchema _ = ...
> -- ... instance using 'foo' as 'Int' and 'bar' as 'MyTypeJSONRepr'
> -- converting 'bar' using @ 'from' @
> --
> -- I'm so allergic to writing this by hand that I can't even be
> -- bothered to put it into an example. Rest assured, it's annoying
> -- and easy to make mistakes with.
>
> instance O.ToJSON Test where
> toJSON _ = ...
> toEncoding _ = ...
> -- ... instance using 'foo' as 'Int' and 'bar' as 'MyTypeJSONRepr'
> -- converting 'bar' using @ 'from' @.
>
> instance O.FromJSON Test where
> parseJSON = ...
> -- ... instance parsing 'foo' as 'Int' and 'bar' as 'MyTypeJSONRepr'
> -- converting 'bar' using @ 'from' @
In actual examples the hand-written code is 8-10 times larger than
with the declarative syntax.
| version | uploaded | uploader | | changes |
|---|
| 0.1.0 files | 2026-05-11 15:03 UTC | MikeLedger | | +710/−0 lines, 4 filesdep +aesondep +basedep +hspec |
Dependencies of records-edsl-0.1.0
aeson >=0 2.3.2.0 → 2.3.3.0
| 2026-11-23 21:23 UTC | 2.3.3.0 | +124/−38 lines, 10 filesPVP ok |
| 2026-09-12 18:04 UTC | 2.3.2.0 | +97/−60 lines, 13 filesPVP ok |
| 2026-07-05 10:37 UTC | 2.3.1.0 | +101/−42 lines, 17 filesdep ~text-iso8601PVP ok |
| 2026-05-21 08:35 UTC | 2.3.0.0 | +54/−41 lines, 17 filesdep ~nothunksdep ~text-iso8601new-uploaderPVP ok |
| 2026-08-29 13:20 UTC | 2.2.5.1 | +36/−24 lines, 4 filesnew-uploaderPVP ok |
showing 5 of 106 versions
base <5 4.22.0.0 → 4.22.1.0
showing 5 of 61 versions
hspec >=0 2.11.17 → 2.11.18
| 2026-10-01 14:14 UTC | 2.11.18 | +7/−4 lines, 3 filesdep ~hspec-coredep ~hspec-discoverPVP ok |
| 2026-03-04 18:01 UTC | 2.11.17 | +11/−19 lines, 6 filesdep ~hspec-coredep ~hspec-discoverPVP ok |
| 2025-12-12 14:07 UTC | 2.11.16 | +25/−7 lines, 5 filesdep ~hspec-coredep ~hspec-discoverPVP: major bump suggested |
| 2025-12-08 03:04 UTC | 2.11.15 | +8/−5 lines, 3 filesdep ~hspec-coredep ~hspec-discoverPVP ok |
| 2025-09-30 14:32 UTC | 2.11.14 | +9/−7 lines, 4 filesdep ~hspec-coredep ~hspec-discoverPVP: major bump suggested |
showing 5 of 171 versions
openapi3 >=0 3.2.4 → 3.2.5
| 2026-04-22 21:34 UTC | 3.2.5 | +538/−149 lines, 19 filesdep ~QuickCheckdep ~basedep ~base-compat-batteriesPVP: major bump suggested |
| 2023-11-20 10:54 UTC | 3.2.4 | +55/−18 lines, 6 filesdep ~QuickCheckdep ~basedep ~base-compat-batteriesPVP: major bump suggested |
| 2022-12-20 11:22 UTC | 3.2.3 | +158/−50 lines, 12 filesdep −networkdep ~aesondep ~basedep ~base-compat-batteriesPVP: major bump suggested |
| 2022-03-13 19:54 UTC | 3.2.2 | +141/−6 lines, 5 filesdep ~aesondep ~basedep ~hspecPVP: major bump suggested |
| 2022-02-04 22:06 UTC | 3.2.1 | +21/−8 lines, 3 filesdep ~basedep ~bytestringdep ~template-haskellPVP: major bump suggested |
showing 5 of 11 versions
optics >=0 0.4.2 → 0.4.2.1
| 2023-06-22 21:13 UTC | 0.4.2.1 | +44/−27 lines, 7 filesdep ~containersdep ~inspection-testingdep ~optics-corePVP ok |
| 2022-05-19 19:52 UTC | 0.4.2 | +14/−4 lines, 2 filesdep ~mtldep ~optics-extradep ~transformersPVP ok |
| 2022-03-22 06:29 UTC | 0.4.1 | +119/−69 lines, 10 filesdep +tasty-benchdep −criteriondep ~optics-coredep ~optics-extradep ~optics-thnew-uploaderPVP ok |
| 2021-02-22 19:54 UTC | 0.4 | +610/−258 lines, 13 filesdep ~arraydep ~basedep ~containersPVP ok |
| 2020-04-15 21:03 UTC | 0.3 | +231/−40 lines, 9 filesdep +QuickCheckdep +tasty-quickcheckdep ~optics-coredep ~optics-extradep ~optics-thPVP ok |
showing 5 of 7 versions
records-edsl-core >=0.1.0 && <0.2 (empty) → 0.1.0
| 2026-05-11 15:03 UTC | 0.1.0 | +813/−0 lines, 7 filesdep +basedep +haskell-src-metadep +megaparsec |
records-edsl-deriving-aeson >=0.1.0 && <0.2 (empty) → 0.1.0
| 2026-05-11 15:03 UTC | 0.1.0 | +560/−0 lines, 3 filesdep +aesondep +basedep +records-edsl-core |
records-edsl-deriving-openapi3 >=0.1.0 && <0.2 (empty) → 0.1.0
| 2026-05-11 15:03 UTC | 0.1.0 | +515/−0 lines, 3 filesdep +basedep +openapi3dep +optics |
records-edsl-deriving-optics >=0.1.0 && <0.2 (empty) → 0.1.0
| 2026-05-11 15:03 UTC | 0.1.0 | +500/−0 lines, 3 filesdep +basedep +opticsdep +records-edsl-core |
records-edsl-deriving-quickcheck >=0.1.0 && <0.2 (empty) → 0.1.0
| 2026-05-11 15:03 UTC | 0.1.0 | +450/−0 lines, 3 filesdep +QuickCheckdep +basedep +generic-random |
relude >=0 1.2.2.1 → 1.2.2.2
| 2025-08-05 12:09 UTC | 1.2.2.2 | +6/−2 lines, 3 filesdep ~basedep ~doctestdep ~hedgehogPVP: minor bump suggested |
| 2025-07-29 10:01 UTC | 1.2.2.1 | +78/−75 lines, 16 filesnew-uploaderPVP: major bump suggested |
| 2024-10-13 17:29 UTC | 1.2.2.0 | +19/−8 lines, 3 filesdep ~basedep ~containersdep ~doctestPVP: major bump suggested |
| 2023-10-04 10:32 UTC | 1.2.1.0 | +474/−392 lines, 10 filesdep ~basedep ~containersdep ~deepseqPVP: major bump suggested |
| 2023-03-01 16:34 UTC | 1.2.0.0 | +149/−108 lines, 60 filesdep ~basedep ~bytestringdep ~deepseqPVP ok |
showing 5 of 16 versions
text >=0 2.1.4 → 2.1.5
| 2026-11-27 23:30 UTC | 2.1.5 | +33786/−32979 lines, 58 filesPVP: major bump suggested |
| 2026-01-28 08:30 UTC | 2.1.4 | +30991/−20199 lines, 35 filesdep +template-haskell-liftdep ~QuickCheckdep ~template-haskellPVP ok |
| 2025-08-01 20:08 UTC | 2.1.3 | +2107/−1827 lines, 30 filesdep +splitmixdep +temporarydep ~QuickCheckdep ~ghc-primdep ~template-haskellPVP ok |
| 2024-10-26 13:22 UTC | 2.1.2 | +43588/−15378 lines, 41 filesdep ~basedep ~binaryPVP: major bump suggested |
| 2024-02-16 22:16 UTC | 2.1.1 | +986/−412 lines, 26 filesdep ~QuickCheckdep ~ghc-primdep ~template-haskellPVP: major bump suggested |
showing 5 of 83 versions
time >=0 1.16 → 1.16.0.1
| 2026-07-20 21:55 UTC | 1.16.0.1 | +1203/−148 lines, 25 filesPVP ok |
| 2026-05-03 08:43 UTC | 1.16 | +353/−64 lines, 29 filesdep +template-haskell-liftdep ~template-haskellPVP ok |
| 2025-08-04 16:22 UTC | 1.15 | +1407/−743 lines, 56 filesdep ~basedep ~deepseqdep ~template-haskellPVP ok |
| 2024-03-10 22:18 UTC | 1.14 | +6594/−5536 lines, 73 filesdep +template-haskelldep ~basePVP ok |
| 2021-10-18 05:36 UTC | 1.13 deprecated | +1279/−1589 lines, 59 filesdep ~basePVP ok |
showing 5 of 48 versions
witch >=0 1.4.0.0 → 1.4.0.1
| 2026-09-28 14:59 UTC | 1.4.0.1 | +2/−2 lines, 1 filesdep ~taggedPVP ok |
| 2026-06-22 14:40 UTC | 1.4.0.0 | +3/−51 lines, 4 filesPVP ok |
| 2026-06-22 13:46 UTC | 1.3.4.0 | +55/−1 lines, 4 filesPVP ok |
| 2026-06-05 19:24 UTC | 1.3.3.0 | +35/−1 lines, 4 filesPVP ok |
| 2026-05-26 15:12 UTC | 1.3.2.0 | +1683/−6 lines, 4 filesdep +hedgehogdep +os-stringdep ~HUnitdep ~basedep ~bytestringPVP ok |
showing 5 of 67 versions
Reverse dependencies
no known reverse dependencies