sectionYPositions = computeSectionYPositions($el), 10)"
x-init="setTimeout(() => sectionYPositions = computeSectionYPositions($el), 10)"
>
On This Page
CConv.Encodetype 'a output = {unit : 'a;bool : bool -> 'a;float : float -> 'a;char : char -> 'a;int : int -> 'a;nativeint : nativeint -> 'a;int32 : int32 -> 'a;int64 : int64 -> 'a;string : string -> 'a;list : 'a list -> 'a;option : 'a option -> 'a;record : (string * 'a) list -> 'a;tuple : 'a list -> 'a;sum : string -> 'a list -> 'a;}val string_target : string outputPrint values. Caution, inefficient! Should be used for debugging only
A way to encode values of type 'src into any serialization format
val unit : unit encoderval bool : bool encoderval float : float encoderval char : char encoderval int : int encoderval nativeint : nativeint encoderval int32 : int32 encoderval int64 : int64 encoderval string : string encoderval record : 'r record_encoder -> 'r encoderEncode a record, using the polymorphic record record_encoder to generate an association list
val record_fix : ('r encoder -> 'r record_encoder) -> 'r encoderFixpoint on record definition
Example:
type point = {x:int; y:int; c:string};;
let enc_point = record
{record_emit=fun into {x;y;c} ->
[ "x", into.int x
; "y", into.int y
; "c", into.string c
]
} ;;val tuple : 'a tuple_encoder -> 'a encoderGeneral encoding of tuples (returns a list of values)
val sum : 'a sum_encoder -> 'a encoderval sum0 : ('a -> string) -> 'a encoderConstant sums, only put the name
val sum_fix : ('a encoder -> 'a sum_encoder) -> 'a encoderFixpoint on sum types
Example:
type tree = Empty | Leaf of int | Node of tree * tree;;
let encode_tree = sum_fix
(fun self -> {sum_emit=fun into x -> match x with
| Empty -> "empty", []
| Leaf i -> "leaf", [int.emit into i]
| Node (l,r) -> "node", [self.emit into l; self.emit into r]
});;