Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/juspay/jrec
Literally the best anonymous records
https://github.com/juspay/jrec
haskell records
Last synced: 3 months ago
JSON representation
Literally the best anonymous records
- Host: GitHub
- URL: https://github.com/juspay/jrec
- Owner: juspay
- License: bsd-3-clause
- Created: 2020-07-27T15:54:15.000Z (over 4 years ago)
- Default Branch: master
- Last Pushed: 2023-03-13T00:52:55.000Z (over 1 year ago)
- Last Synced: 2024-03-02T13:33:41.492Z (8 months ago)
- Topics: haskell, records
- Language: Haskell
- Homepage:
- Size: 98.6 KB
- Stars: 35
- Watchers: 17
- Forks: 6
- Open Issues: 9
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# jrec — anonymous records for busy people
Based on [superrecord](https://hackage.haskell.org/package/superrecord), but simplified. No automatic field reordering. No GHCJS bits inside. Easier to hack on.
## Benefits
* Nice construction syntax:
```haskell
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:
```bash
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](https://hackage.haskell.org/package/superrecord).