package ppx_unreachable

All checked builds pass
  1. Overview
  2. Docs
A tool for denoting unreachable control flow paths

Install

dune-project
 Dependency

Authors

Maintainers

Sources

ppx_unreachable-1.1.tbz
sha256=0979883ca31f4f1b8528769d779f25f149c2ccb0b039f7cc0bfe0d40654b1672
sha512=2f8d1cd3fa52f5ea13510d54aa957ab99b5097e8afec8888ceda2e827047218f5bb952e065db7c870f673a068db91ec9e2e6dd652a561ad46b73cfe23fe42128

Description

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

Added to opam-repository:

README

ppx_unreachable

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

Install

opam install ppx_unreachable

Example

let test_map x y =
  match List.map (fun x -> 2 * x) [x; y] with
  | [x'; y'] -> "this branch will always be taken"
  | _ -> [%unreachable]

(* Bad example *)
let test_if x =
  if x > 10 then
    "big"
  else if x < 0 then
    "small"
  else
    [%unreachable]

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

let () = test_if 5 (* unreachable branch hit - test.ml:13 *)
let () = test_if_msg 5 (* unreachable branch hit - 0 <= x <= 10 *)

Dependencies (3)

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

Dev Dependencies (1)

  1. odoc with-doc

Optional Dependencies

None

Used by (1)

  1. ephemeral

Conflicts

None

Build status

Results of building ppx_unreachable with each compiler on check.ci.ocaml.org, run of against opam-repository 78c202b. All results for this package.

Each result links to its build log. To keep crawlers from overloading the site, build logs require a GitHub sign-in (see ocurrent/opam-health-check). On your first log, GitHub asks you to “Authorize opam-health-check”, the OCurrent app that runs these checks; it sees only your public profile, not your repositories. The sign-in lasts 30 days.

Version OCaml 4.11 OCaml 4.14 OCaml 5.2 OCaml 5.4 OCaml 5.5
1.1 (this version) good good good good good
  • good Package successfully built
  • partial One of the dependencies failed to build
  • bad Package failed to build
  • n/a Package is not available in this environment
  • internal Internal failure