package ppx_unreachable

  1. Overview
  2. Docs
A PPX that denotes unreachable code and prints descriptive errors when the code is reached

Install

Dune Dependency

Authors

Maintainers

Sources

ppx_unreachable-1.0.tbz
sha256=8af03f3cf8ccb52f3bd7f95f49474f9060ce37d0d21ad82e569352e48e1d5fac
sha512=2e7820f5fe8b8c113bdd0715e3a1e1afac851538fc865d4755ab64a8b34bd5a4bdb2641e09508f51d86e20920156fed2f685409736766dd6e560d50d76720159

Description

A PPX that denotes unreachable code and prints descriptive errors when the code is reached

Published: 30 May 2025

README

ppx_unreachable

A PPX that denotes unreachable code and prints descriptive errors when the code is reached

Example

Obviously, this is a case where unreachable is not applicable, however the applicable cases are not demonstratable.

let test_if x =
  if x > 10 then
    "big"
  else if x < 0 then
    "small"
  else
    [%unreachable]

let () = test_if 5 (* unreachable branch hit - test.ml:7 *)

Dependencies (3)

  1. ppxlib >= "0.36"
  2. dune >= "3.9"
  3. ocaml

Dev Dependencies (1)

  1. odoc with-doc

Used by

None

Conflicts

None

OCaml

Innovation. Community. Security.