package ppx_meta_conv
Install
Dune Dependency
Authors
Maintainers
Sources
md5=aad544375f23a3979aafe9defdebf4bd
sha512=991ad7433c8f2f51b298d4c99b35b873aab66c5d1da1beaa18f8f58f8e708e5a4299f0bb657af9d12bfcd3d645f48b3efe21e13b8c62e303604bd374e88f7d3a
doc/ppx_meta_conv.runtime/Meta_conv/Coder/Make/Helper/index.html
Module Make.Helper
Source
Useful tool functions for writing encoders+decoders of primitive types
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.
typical <targe_type>_of_mc_lazy_t
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.