package oasis

  1. Overview
  2. Docs
Legend:
Library
Module
Module type
Parameter
Class
Class type

OCaml data notation.

This module helps to translate OCaml data into a string following OCaml syntax.

Types

type module_name = string
type field_name = string
type variant_name = string
type var_name = string
type t =
  1. | REC of module_name * (field_name * t) list
    (*

    List

    *)
  2. | LST of t list
    (*

    String

    *)
  3. | STR of string
    (*

    Variant type constructor

    *)
  4. | VRT of variant_name * t list
    (*

    Boolean

    *)
  5. | BOO of bool
    (*

    Tuple

    *)
  6. | TPL of t list
    (*

    Unit ()

    *)
  7. | UNT
    (*

    Function application

    *)
  8. | APP of var_name * (var_name * t) list * t list
    (*

    Variable

    *)
  9. | VAR of var_name
    (*

    Polymorphic variant

    *)
  10. | PVR of variant_name * t option

Basic conversion

val of_unit : unit -> t
val of_bool : bool -> t
val of_string : string -> t
val of_option : ('a -> t) -> 'a option -> t
val of_list : ('a -> t) -> 'a list -> t

Function conversion

type 'a func = {
  1. func_call : 'a;
  2. func_name : string;
  3. func_arg : t option;
}

Function that can be generated using func_call = APP(func, , func_arg).

val func : 'a -> string -> 'a func

Return the OCaml function corresponding to a func.

val func_with_arg : ('a -> 'b) -> string -> 'a -> ('a -> t) -> 'b func

Create a func with an argument

val func_with_arg_ctxt : (ctxt:'a -> 'b -> 'c) -> string -> 'b -> ('b -> t) -> (ctxt:'a -> 'c) func
val odn_of_func : 'a func -> t

Return the t code corresponding to a func.

val func_call : 'a func -> 'a

Return the OCaml function corresponding to a func.

Formating

val pp_odn : ?opened_modules:string list -> Format.formatter -> t -> unit
OCaml

Innovation. Community. Security.