Module OASISDataNotation

module OASISDataNotation: sig .. end
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 = 
| REC of module_name
* (field_name * t) list
(*
List
*)
| LST of t list (*
String
*)
| STR of string (*
Variant type constructor
*)
| VRT of variant_name * t list (*
Boolean
*)
| BOO of bool (*
Tuple
*)
| TPL of t list (*
Unit ()
*)
| UNT (*
Function application
*)
| APP of var_name
* (var_name * t) list
* t list
(*
Variable
*)
| VAR of var_name (*
Polymorphic variant
*)
| 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 = {
   func_call : 'a;
   func_name : string;
   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