Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/sim642/ppx_deriving_hash
[@@deriving hash]
https://github.com/sim642/ppx_deriving_hash
hacktoberfest ocaml ppx ppx-deriver ppx-extension ppxlib
Last synced: 25 days ago
JSON representation
[@@deriving hash]
- Host: GitHub
- URL: https://github.com/sim642/ppx_deriving_hash
- Owner: sim642
- License: mit
- Created: 2021-05-21T12:49:53.000Z (over 3 years ago)
- Default Branch: master
- Last Pushed: 2024-08-25T14:50:49.000Z (5 months ago)
- Last Synced: 2024-10-30T05:00:51.039Z (2 months ago)
- Topics: hacktoberfest, ocaml, ppx, ppx-deriver, ppx-extension, ppxlib
- Language: OCaml
- Homepage:
- Size: 40 KB
- Stars: 1
- Watchers: 3
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.md
Awesome Lists containing this project
README
# ppx_deriving_hash
## `[@@deriving hash]`[![ci workflow status](https://github.com/sim642/ppx_deriving_hash/actions/workflows/ci.yml/badge.svg)](https://github.com/sim642/ppx_deriving_hash/actions/workflows/ci.yml)
[![GitHub release status](https://img.shields.io/github/v/release/sim642/ppx_deriving_hash)](https://github.com/sim642/ppx_deriving_hash/releases)
[![opam package status](https://badgen.net/opam/v/ppx_deriving_hash)](https://opam.ocaml.org/packages/ppx_deriving_hash)Deriver for standard hash functions without extra dependencies.
## Installation
```console
opam install ppx_deriving_hash
```## Usage
In dune:
```
(preprocess (pps ppx_deriving_hash))
```## Syntax
* Use `[@@deriving hash]` after a type definition to derive the function `val hash: t -> int` for it (if the type is named `t`) or `val ty_hash: ty -> int` (otherwise if the type is named `ty`).
* Use `[@hash fun x -> ...]` after a type expression to override the underlying hash function used for it.
* Use `[%hash: ty]` as an expression for the hash function of type `ty`.