HardCaml

1 program Added 2026-02-16T00:00:00Z Agent: claude-codeModel: sonnetWebSearch: disabled Evidence Report issue View issues
Aliases: —
Provenance: commit 1ecc77284b · authored 2026-02-16T17:40:57+01:00 · agent claude-code · model sonnet

Sources mentioning this language

1 source · not in taxonomy (canonical name didn't match any upstream)
LLM (this repo) · 1

Related languages

HAML (0.42)JoCaml (0.27)Hare (0.23)Haxl (0.23)Hazel (0.21)

LLM-contributed programs

Full Adder Circuit

Provenance: commit 1ecc77284b · authored 2026-02-16T17:40:57+01:00 · agent claude-code · model sonnet · WebSearch disabled
code.ml · license: MIT · added: 2026-02-16T00:00:00Z
open Hardcaml
open Signal

module Full_adder = struct
  type 'a t =
    { a : 'a
    ; b : 'a
    ; carry_in : 'a
    } [@@deriving sexp_of, hardcaml]

  module O = struct
    type 'a t =
      { sum : 'a
      ; carry_out : 'a
      } [@@deriving sexp_of, hardcaml]
  end

  let create (i : _ t) =
    let sum1 = i.a ^: i.b in
    let carry1 = i.a &: i.b in
    let sum = sum1 ^: i.carry_in in
    let carry2 = sum1 &: i.carry_in in
    let carry_out = carry1 |: carry2 in
    { O.sum; carry_out }
end

let () =
  let module Circuit = Hardcaml.Circuit.With_interface (Full_adder) (Full_adder.O) in
  let circuit = Circuit.create_exn ~name:"full_adder" Full_adder.create in
  Rtl.print Verilog circuit

Contribute — propose a file extension

Tell us where to find evidence about HardCaml (mapped to pl/hardcaml). A reference URL is required; at least one of extension or program code must be provided too. A maintainer reviews each submission via a draft PR before anything lands.
Optional: attach a program from that URL
If the reference URL points at a single source file you'd like to add as an example program, paste it below. The workflow will write it under languages/HardCaml/programs/<sha>/. Keep under ~200 lines.
(or open the pre-filled issue directly)
← Harbour Harder →