package pythonlib

  1. Overview
  2. Docs
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 -> Pytypes.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 -> Pytypes.pyobject -> 'a

python_to_ocaml typerep pybobject converts a python object pyobject to an ocaml value according to some type description typerep.

val parse : string -> Typerep.packed

parse str parses an ocaml like string into a type representation. str cannot include any function.

val register_named_type : name:string -> ocaml_type:string -> unit

register_named_type ~name ~ocaml_type registers a named type that can be used in parse with name name. Values for this type will be type checked to match ocaml_type which should be a proper type annotation for the current toplevel, e.g. "t" if a type t is currently defined in the toplevel. A capsule is used to send and receive values to/from python.

val of_type : Type.t -> Typerep.packed