Module Defun.Vim
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.
val return : 'a Type.t -> ('a Core.Or_error.t api_call, unit, 'a) tWraps a
Type.tto 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) tval (@->) : 'a Type.t -> ('b, _, 'output) t -> ('a -> 'b, 'a, 'output) tAdd 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 -> bufferwould use the arityInteger @-> 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
ObjectorDictionary, then wrap the output ofwrap_viml_functionto call your serialization or deserialization functions.