package camlon
type t =
| Bool of bool
| Int31 of int
(*int for 32 bit arch
*)| Int63 of int64
(*int for 64 bit arch
*)| Int32 of int32
| Int64 of int64
| Nativeint32 of int32
(*natint for 32 bit arch
*)| Nativeint64 of int64
(*natint for 64 bit arch
*)| Float of float
| Char of char
| String of string
| List of t list
| Array of t list
| Variant of string * t option
| Poly_variant of string * t option
| Record of (string * t) list
| Object of (string * t) list
| Tuple of t list
| Unit
| IntGen of string * char
(*Generic integer with a postfix character, like 1234x
*)| Var of Longident.t
| App of t * ((bool * string) option * t) list
| Seq of t list
(*t; t; t; ..
*)
The data type.
Note on lists:
* List literals [..]
, including the null list []
, are parsed and printed as List ..
, not with Variant (..)
. * Cons cells x::xs
are parsed and printed using Variant (..)
.
Record style Variant arguments are expressed as Varaint (Record ..).
type ocaml = t
Escape the special characters of the given string like String.escaped
.
String.escaped
and the format string's "%S"
is too mean for UTF8 strings. escape_string
does not escape characters whose code is more than 128.
This function returns the argument itself if there is no need of escaping.
val format : Format.formatter -> t -> unit
Formatter of type t
val format_no_poly : Format.formatter -> t -> unit
Formatter of type t
. Same as format
, but prints polymorphic variants and objects as variants and records
val format_with : ('a -> t) -> Format.formatter -> 'a -> unit
Same as format
but, but prints polymorphic variants and objects as variants and records
val format_no_poly_with : ('a -> t) -> Format.formatter -> 'a -> unit
Same as format_with
but
module Parser : sig ... end
val load : string -> (t list, Parser.error) result
Load values of t
printed in a file
val load_with :
(t -> ('a, 'b) result) ->
string ->
('a list, 'b load_error) result
Load values of t
printed in a file, then convert them using the decoder
val save : perm:int -> ?no_poly:bool -> string -> t list -> unit
Save values of t
to a file
val save_with :
('a -> t) ->
perm:int ->
?no_poly:bool ->
string ->
'a list ->
unit
Save OCaml values to a file, converting them to type t