Skip to main content

Module TableclothMap.Poly

Construct a Map which can be keyed by any data type using the polymorphic compare function.

type identity​

type identity

type t​

type nonrec ('key, 'value) t = ( 'key, 'value, identity ) t

val empty​

val empty : unit -> ( 'key, 'value ) t

A map with nothing in it.

val singleton​

val singleton : key:'key -> value:'value -> ( 'key, 'value ) t

Create a map from a key and value

Examples

Map.Poly.singleton ~key:false ~value:1 |> Map.toList = [(false, 1)]

val fromArray​

val fromArray : ('key * 'value) array -> ( 'key, 'value ) t

Create a map from an Array of key-value tuples

val from_array​

val from_array : ('key * 'value) array -> ( 'key, 'value ) t

val fromList​

val fromList : ('key * 'value) list -> ( 'key, 'value ) t

Create a map from a List of key-value tuples

val from_list​

val from_list : ('key * 'value) list -> ( 'key, 'value ) t