Last active
May 31, 2020 21:16
-
-
Save Gbury/9eae3a590d2e73ce6a77f595cf293a49 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type t = { | |
name : string; | |
tags : Tag.S.t; | |
} | |
let mk name tags = { name; tags; } | |
let tags t = t.tags |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type t | |
(** the type of events *) | |
val mk : string -> Tag.S.t -> t | |
(** create a new event. *) | |
val tags : t -> Tag.S.t | |
(** Return the set of tags for the event. *) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(* check whether the event has at least one of the tags in tag_set *) | |
let is_interested tag_set event = | |
not (Tag.S.is_empty (Tag.S.inter tag_set (Event.tags event))) | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type t = string | |
let print fmt t = | |
Format.fprintf fmt "%s" t | |
let hash x = Hashtbl.hash x | |
let compare = String.compare | |
let equal x y = compare x y = 0 | |
end | |
(* use S here instead of Set to avoid potential name clashed *) | |
module S = Set.Make(struct | |
type nonrec t = t | |
let compare = compare | |
end) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
type t | |
(** Type for tags *) | |
val print : Format.formatter -> t -> unit | |
val hash : t -> int | |
val equal : t -> t -> bool | |
val compare : t -> t -> int | |
module S : Set.S with type elt = t |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment