package ppx_unreachable

  1. Overview
  2. Docs
On This Page
  1. Example
Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source

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 *)
OCaml

Innovation. Community. Security.