1
1
mirror of https://github.com/juspay/jrec.git synced 2024-08-16 05:40:33 +03:00
Literally the best anonymous records
Go to file
2020-08-19 20:00:49 -04:00
.github/workflows Add CI matrix with GHC 8.10 support; enable Cachix (#5) 2020-08-04 22:55:47 -04:00
.vscode Add ormolu and HLS 2020-08-04 21:33:15 -04:00
bin Add empty tests 2020-07-31 17:55:54 -04:00
src Rename, and expose JRec.Internal 2020-08-19 19:47:52 -04:00
test Add append 2020-08-19 19:42:44 -04:00
.gitignore Initialize project layout 2020-07-29 20:16:57 -04:00
CHANGELOG.md Initialize project layout 2020-07-29 20:16:57 -04:00
default.nix Add CI matrix with GHC 8.10 support; enable Cachix (#5) 2020-08-04 22:55:47 -04:00
hie.yaml Finish IDE support 2020-08-19 19:32:05 -04:00
jrec.cabal Make bin/test reload automatically 2020-08-19 20:00:49 -04:00
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
Setup.hs Initialize project layout 2020-07-29 20:16:57 -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.