Legend:
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Page
Library
Module
Module type
Parameter
Class
Class type
Source
Transformation for view patterns in OCaml. Attempts to imitate Haskell view patterns.
In dune:
(preprocess (pps ppx_viewpattern))
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,pat
and exp
parts of a view pattern itself.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).