package ppx_meta_conv

  1. Overview
  2. Docs
PPX for converting between OCaml values and JSON, Sexp and camlon

Install

Dune Dependency

Authors

Maintainers

Sources

ppx_meta_conv-4.1.0.tar.gz
md5=aad544375f23a3979aafe9defdebf4bd
sha512=991ad7433c8f2f51b298d4c99b35b873aab66c5d1da1beaa18f8f58f8e708e5a4299f0bb657af9d12bfcd3d645f48b3efe21e13b8c62e303604bd374e88f7d3a

doc/ppx_meta_conv.runtime/Meta_conv/Coder/Make/index.html

Module Coder.MakeSource

If you want to write an instance of meta_conv implementation, you define the following primitive encoders and decoders at least.

Parameters

module A : Types.Min

Signature

include Types.Min with type target = A.target
type target = A.target
val format : Format.formatter -> target -> unit

The target must be printable.

Sourcemodule Constr : sig ... end
Sourcemodule Deconstr : sig ... end

Primitive ADT decoders. They may raise exceptions.

Sourceexception Exception of target Error.t

Exception for decoding error. We must declare here and not in a more general place, since the error contains target, and we cannot have polymorphic exceptions in OCaml.

Sourcetype 'a encoder = ('a, target) Types.Encoder.t
Sourcetype 'a decoder = ('a, target) Types.Decoder.t
Sourcetype 'a decoder_exn = ('a, target) Types.Decoder.t_exn
Sourcemodule DeconstrDecoder : sig ... end

Auto generated decoders from Deconstr

Sourceval exn : 'a decoder -> 'a decoder_exn

Result monad decoder to decoder with runtime exception Exception.

Sourceval result : 'a decoder_exn -> 'a decoder

Any exception (including Exception) reported from decoder_exn is reported as Error

Sourceval throw : target Error.t -> 'exn

raises Exception

Sourceval catch : ('a -> 'b) -> 'a -> ('b, target Error.t) Result.t
Sourceval from_Ok : ('a, target Error.t) Result.t -> 'a

If the argument is Error e, raises Exception e.

Sourceval format_error : Format.formatter -> target Error.t -> unit

Format the error, without its trace

Sourceval format_full_error : Format.formatter -> target Error.t -> unit

Format the error, with its full trace

Sourceval format_with : ('host -> target) -> Format.formatter -> 'host -> unit

Format host data using its encoder

Sourcemodule Helper : sig ... end
OCaml

Innovation. Community. Security.