ppx_optional

Pattern matching on flat options
README

A ppx rewriter that rewrites simple match statements with an if then
else expression.

Syntax

ppx_optional rewrites the extension match%optional in expressions.
It requires that a module Optional_syntax is in scope, and that it
has is_none and unchecked_value values.

For instance:

match%optional e with
| None -> none_expression
| Some x -> some_expression

becomes:

if Optional_syntax.is_none e then begin
   none_expression
end else begin
   let x = Optional_syntax.unchecked_value e in
   some_expression
end

Usage

This is normally used to safely access an optional value while
avoiding allocation for immediate values
(e.g. Immediate.{Char,Bool,Int}.Option, Fixed.Option,
Price.Fixed.Option, etc...).

Install
Published
15 Dec 2017
Sources
ppx_optional-v0.10.0.tar.gz
md5=ab4ec740974fe5019d049fb190385105
Dependencies
ocaml-migrate-parsetree
>= "0.4" & < "2.0.0"
jbuilder
>= "1.0+beta12"
ppx_metaquot
>= "v0.10" & < "v0.11"
ppx_driver
>= "v0.10" & < "v0.11"
ppx_core
>= "v0.10" & < "v0.11"
ocaml
>= "4.04.1"
Reverse Dependencies
ppx_jane
= "v0.10.0"