package ppx_deriving_hardcaml

  1. Overview
  2. Docs
PPX deriving plugin for HardCaml

Install

Dune Dependency

Authors

Maintainers

Sources

v1.1.0.tar.gz
sha256=2b86f61ff4917591f4de5e38a39da4dde8801f905eba097cebbb6cfe12576164
md5=e51cadf6d9f47d662e89e3106507d7b3

Description

Tags

syntax hardcaml

Published: 10 Jan 2017

README

ppx_deriving Plugin for HardCaml

This module implements a plugin for the ppx_deriving rewriter that supports the HardCaml syntax:

  • Provide a record annotation to generate helper functions

  • Provide an optional bits attribute for signals

  • Provide a required width attribute for list and array

Examples

Module interface

Original syntax:

module S : interface
  signal
  signal_list{ }
  signal_array{| |}
end

New syntax:

module S : sig
  type 'a t = {
    signal       : 'a;
    signal_list  : 'a list;
    signal_array : 'a array;
  } [@@deriving hardcaml]
end

Module implementation

Original syntax:

module S = interface
  signal[2]
  signal_list{2}[4]
  signal_array{|2|}[4]
end

New syntax:

module S = struct
  type 'a t = {
    signal       : 'a       [@bits 2];
    signal_list  : 'a list  [@length 2][@bits 4];
    signal_array : 'a array [@length 2][@bits 4];
  } [@@deriving hardcaml]
end

Dependencies (4)

  1. ppx_deriving >= "4.0" & < "4.3"
  2. ocamlfind build
  3. hardcaml >= "1.1.0" & < "2.0.0"
  4. ocaml >= "4.03"

Dev Dependencies (1)

  1. ounit with-test

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.