Module Session.State

State descriptors.

FIXME. encode allow errors ? pp ?

type 'a t = 'a state
val v : eq:('a -> 'a -> bool) -> encode:('a -> string) -> decode:(string -> ('a, string) Stdlib.result) -> unit -> 'a state

v ~eq ~encode ~decode () tests state for equality with eq, encodes it to bytes with encode and decodes from bytes with decode.

val eq : 'a state -> 'a -> 'a -> bool

eq sd is the equality function of sd.

val encode : 'a state -> 'a -> string

encode sd is the encoding function of sd.

val decode : 'a state -> string -> ('a, string) Stdlib.result

decode sd is the decoding function of sd.

val option_eq : 'a state -> 'a option -> 'a option -> bool

option_eq sd is eq trivially extended to optional state.