package ppx_matches

  1. Overview
  2. Docs
On This Page
  1. Install
  2. Syntax
A syntax extension for Rust's `matches!` in OCaml ๐Ÿช

Install

dune-project
 Dependency

Authors

Maintainers

Sources

ppx_matches-0.2.0.tbz
sha256=9d9630cd912e2483af1bae545f9bec53aa926be894667e43406b105bed1d60ae
sha512=542e838ca4a6c9045bc6574cdecb4a21cc444f248172ca9b7429b775c28019a358218a93fce2341a389a3d230c5b3e5f369dd2be7870c9900839a6001fc1fc03

doc/README.html

๐Ÿ”ฅ ppx-matches

Install

This library has not yet been released to opam. To install it, first

opam install ppx_matches

Users of dune can then use this PPX on their libraries and executables by adding the appropriate stanza field:

(library
 ...
 (preprocess (pps ppx_matches)))

Syntax

In short:

  • [%matches? pat [when cond]] expands to

      function
    | pat [when cond] -> true
    | _ -> false
  • [%matches? pat [when cond]] matchee expands to the inlined version:

      match matchee with
    | pat [when cond] -> true
    | _ -> false