package vcaml

  1. Overview
  2. Docs

A Defun.Vim.t value is a reified value corresponding to the type of a function. It is used by wrap_viml_function to produce a regular ocaml function of the correct type.

type ('f, 'leftmost_input, 'out) t
val return : 'a Type.t -> ('a Core.Or_error.t api_call, unit, 'a) t

Wraps a Type.t to be used as the rightmost (return) type of this function.

val unary : 'a Type.t -> 'b Type.t -> ('a -> 'b Core.Or_error.t api_call, 'a, 'b) t
val (@->) : 'a Type.t -> ('b, _, 'output) t -> ('a -> 'b, 'a, 'output) t

Add an extra argument to an existing function arity.

Using this operator, function types will look extremely closely to how the underlying OCaml type will end up. For example, a vim function with (OCaml) type int -> string -> int -> buffer would use the arity Integer @-> String @-> Integer @-> return Buffer.

Unfortunately, there is currently no nice way to automatically de/serialize more complex/custom types. In those cases, you may need to use Object or Dictionary, then wrap the output of wrap_viml_function to call your serialization or deserialization functions.

OCaml

Innovation. Community. Security.