1
1
mirror of https://github.com/juspay/jrec.git synced 2024-07-07 07:56:29 +03:00
Literally the best anonymous records
Go to file
2023-03-12 20:52:54 -04:00
.github/workflows nix: Build on GHC 8.8 as well 2023-03-12 20:29:33 -04:00
.vscode .vscode: remove tasks.json 2023-03-12 20:52:54 -04:00
bin bin/test: flake'ify 2023-03-12 20:52:24 -04:00
src Restore support for older Aeson (1.x) 2023-03-12 20:29:41 -04:00
test Change append/combine implemantion to simply append records (#24) 2020-11-25 15:34:24 +03:00
.gitignore Initialize project layout 2020-07-29 20:16:57 -04:00
CHANGELOG.md Restore support for older Aeson (1.x) 2023-03-12 20:29:41 -04:00
flake.lock nix: Build on GHC 8.8 as well 2023-03-12 20:29:33 -04:00
flake.nix bin/test: flake'ify 2023-03-12 20:52:24 -04:00
hie.yaml remove Setup.hs and update modules in .cabal 2023-03-11 23:26:33 +05:30
jrec.cabal remove Setup.hs and update modules in .cabal 2023-03-11 23:26:33 +05:30
LICENSE Add BSD3 License file 2020-07-29 20:13:16 -04:00
README.md Make bin/test reload automatically 2020-08-19 20:00:49 -04:00
shell.nix Add working .vscode settings for flakes 2023-03-12 20:52:15 -04:00

jrec — anonymous records for busy people

Based on superrecord, but simplified. No automatic field reordering. No GHCJS bits inside. Easier to hack on.

Benefits

  • Nice construction syntax:

    Rec (#id := 18853, #orderId := "MG13-233")
    
  • Provides Generic instances out of the box. Aeson, etc can't believe these aren't normal records! Anything Generic-derived just works.

  • Provides generic-lens and generic-optics instances out of the box. Due to those custom instances, we support polymorphic updates.

  • O(1) field access, O(n) construction.

  • PureScript-style partial records — if you have a Rec ("foo" := Int ': rest), HasField "foo" will work just fine.

Developing

IDE support is available inside nix-shell. For example, if you use VS Code, you may launch it as:

nix-shell --run "code ."

Tests

Run bin/test for fast-reloading tests. When library sources change, the test script will reload instantly and re-run the tests.

TODOs

  • Documentation.
  • Expose all internals.
  • -- NOTE: doesn't use 'KeyDoesNotExist' — fix this.
  • RemoveAccessTo — can we get rid of it?

Acknowledgement

  • The JRec.Internal module is entirely based on the code from superrecord.