package ppx_meta_conv
Install
Dune Dependency
Authors
Maintainers
Sources
sha256=0e9945064e1057e9dccf586434a399fba4251812d14fc51050b2cc5e76a47c2b
md5=536ea6b606a1217feccffac4609b5ece
doc/ppx_meta_conv.runtime/Meta_conv/Coder/Make/Helper/index.html
Module Make.Helper
Useful tool functions for writing encoders+decoders of primitive types
val integer_of_float :
float ->
float ->
(float -> 'int) ->
float ->
('int, string) Result.t
float to integer conversion with error checks.
This is not target type dependent, but it is here for easier access.
typical list_of_<targe_type>. It takes a function to get a list from a target value
typical array_of_<targe_type>. It takes a function to get a list from a target value
typical option_of_<targe_type>. It takes predicate to check the arg is a Some, None or something else.
Some (Some v) : Some for a target value v Some None : None None : : Error. Target value cannot have the option type
typical ref_of_<targe_type>. It takes predicate to check the arg is a reference or something else.
Some v : Found a record contents = <v>
None : Error. Target value cannot have the option type
typical lazy_t_of_<targe_type>. The decoding is done lazily. Error at the deferred decoding is handled by the error handler, normally it should raises <Target_conv>.Exception exception.
val of_mc_lazy_t : 'a encoder -> ('a, target) Open.mc_lazy_t encoder
typical <targe_type>_of_mc_lazy_t
val mc_lazy_t_of : 'a decoder -> ('a, target) Open.mc_lazy_t decoder
typical mc_lazy_t_of_<targe_type> The decoding is done lazily. Error at the lazy decoding is reported by the result monad.
val mc_fields_of :
(target -> (string * target) list option) ->
'a decoder ->
(string * 'a) list decoder
typical mc_fields_of_<targe_type>
Convert a simple raw deconstr of type target -> 'a
to 'a decoder
. Error must be reported as Failure s
. The other exceptions simply escape.