-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgameGaugesDict.mli
More file actions
61 lines (40 loc) · 1.8 KB
/
gameGaugesDict.mli
File metadata and controls
61 lines (40 loc) · 1.8 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
(** A module that matches [GameVal] is a customizeable value suitable for use as the type of value of [GameDict] *)
module type GameVal = sig
type t
end
(** A module that matches [KeyType] is suitable for use as the type of key of [GameDict]. Keys must be comparable *)
module type KeyType = sig
type t
include Map.OrderedType with type t := t
end
(** A [GameDict] maps keys to game values. [GameDict] *)
module type GameDict = sig
exception InvalidEffect
module GameVal : GameVal
module KeyType : KeyType
type game_value = GameVal.t
type key = KeyType.t
module GameMap : Map.S
(** [t] is the type of [GameDict]*)
type t = game_value GameMap.t
(** [empty] is the empty [GameDict] *)
val empty : t
(** [insert key value dict] is [dict] with [k] bound to [value]. If [key] was already
bound, its previous value is replaced with [v]. *)
val insert : key -> game_value -> t -> t
(** [update key func dict] is [dict] with [key] bound to the new value from [func old_value]. If [key] is not bound...
. *)
val update : key -> (game_value option -> game_value option) -> t -> t
(** [get_size dict] is the number of bindings in [dict] *)
val get_size : t -> int
(** [get_bindings dict] is the list containing the bindings in [dict] *)
val get_bindings : t -> (key * game_value) list
(** [get_key_of value] is the first key that bound to [value] *)
val get_key_of : game_value -> t -> key
(** [get_value_of key dict] is the value bound to key if key exist and none if key is not bound*)
val get_value_of : key -> t -> game_value option
end
(** A [MakeGameDict] is a functor that makes a [GameDict] out of
modules representing keys and values. *)
module MakeGameDict : functor (GVal : GameVal) (K : KeyType) ->
GameDict with module GameVal = GVal and module KeyType = K