Module Knowledge.Persistent

Persistence type class.

A instance of the Persistent type class could be provided to the property declaration to make this property persistent. See the Class.property function.

type 'a t = 'a persistent
val define : to_string:('a -> string) -> of_string:(string -> 'a) -> 'a persistent

define to_string of_string derives an instance of persistent.

Uses the provided of_string and to_string to deserialize and serialize properties.

val derive : to_persistent:('a -> 'b) -> of_persistent:('b -> 'a) -> 'b persistent -> 'a persistent

derive to_persistent of_persistent derives an instance from other instance.

val of_binable : (module Core_kernel.Binable.S with type t = 'a) -> 'a persistent

of_binable t derives persistent from the binable instance t.

val string : string persistent

string is a persistent data type.

val name : name persistent

names are persistent.

  • since 2.2.0
val list : 'a persistent -> 'a list persistent

list t derives persistence for a list.

val sequence : 'a persistent -> 'a Core_kernel.Sequence.t persistent

sequence t derives persistent for a sequence.

val array : 'a persistent -> 'a array persistent

array t derives persistent for an array.

val set : ('a, 'c) Core_kernel.Set.comparator -> 'a t -> ('a, 'c) Core_kernel.Set.t persistent

set order t derives persistent for a set.

val map : ('k, 'c) Core_kernel.Map.comparator -> 'k t -> 'd t -> ('k, 'd, 'c) Core_kernel.Map.t persistent

map order t derives persistent for a map.