Module Python_lib.Py_typerep
module Typerep = Typerep_lib.Std.Typerep
module Named_types : sig ... end
val to_ocaml : _ Typerep.t -> string
to_ocaml typerep
returns an ocaml string representing the type.
val ocaml_to_python : 'a Typerep.t -> 'a -> Python_lib__.Import.pyobject
ocaml_to_python typerep v
converts an arbitrary ocaml object with its typerep representation to a python value. See the implementation for supported constructions.
val python_to_ocaml : 'a Typerep.t -> Python_lib__.Import.pyobject -> 'a
python_to_ocaml typerep pybobject
converts a python objectpyobject
to an ocaml value according to some type descriptiontyperep
.
val parse : string -> Typerep.packed
parse str
parses an ocaml like string into a type representation.str
cannot include any function.
val parse_maybe_fn : string -> [ `fn of Typerep.packed * Typerep.packed | `value of Typerep.packed ]
parse_maybe_fn str
parses an ocaml like string into a type representation.str
can include at most one arrow (in which case`fn
is returned).
val register_named_type : name:string -> ocaml_type:string -> unit
register_named_type ~name ~ocaml_type
registers a named type that can be used inparse
with namename
. Values for this type will be type checked to matchocaml_type
which should be a proper type annotation for the current toplevel, e.g. "t" if a typet
is currently defined in the toplevel. A capsule is used to send and receive values to/from python.