package ppx_optional
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
Pattern matching on flat options
Install
dune-project
Dependency
Authors
Maintainers
Sources
ppx_optional-v0.13.0.tar.gz
sha256=78b9f802f1a4043d8e9b1c4b7b94186f216723b798243a0cb451c9bc4e1cacab
md5=e9b763741e21f66579fb3ac0230ee772
Description
A ppx rewriter that rewrites simple match statements with an if then else expression.
Published: 20 Nov 2019
README
ppx_optional - match statements for zero-alloc options
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 unsafe_value values.
For instance:
match%optional e with
| None -> none_expression
| Some x -> some_expressionbecomes:
if Optional_syntax.is_none e then begin
none_expression
end else begin
let x = Optional_syntax.unsafe_value e in
some_expression
endUsage
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...).
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page