package ppx_viewpattern
View patterns in OCaml
Install
Dune Dependency
Authors
Maintainers
Sources
ppx_viewpattern-0.1.1.tbz
sha256=7edc8a6c112fd430efa62d77c3eb8c1e1320fa5fff9e86e67cced0918b5371bf
sha512=3f41006389d724198a94bdf1282d38509a6d0a7bef9c28d501f96904f35cd6f8835c2e3b1b2269dd573a18b5fc3489731d2250717daa304e9640170e0af858ca
README.md.html
ppx_viewpattern
Transformation for view patterns in OCaml. Attempts to imitate Haskell view patterns.
Installation
opam install ppx_viewpattern
Usage
In dune:
(preprocess (pps ppx_viewpattern))
Syntax
Use [%view? pat when exp]
as a pattern to apply exp
to whatever the pattern is matching and match the result of the exp
application against pat
. Analogous to the Haskell view pattern exp -> pat
.
See example/
for example usage.
Supported in:
match ... with ...
cases,function ...
cases,fun ... -> ...
arguments,let ... in ...
expression binding left-hand sides,try ... with ...
cases,nested inside the
pat
andexp
parts of a view pattern itself.
Caveats
A view pattern disables redundant-case
and partial-match
warnings for the corresponding match
/function
.
Currently unsupported in:
let ...
definition left-hand sides (at top level or in modules).
sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>