diff options
| author | Estevan Castilho <tevo@riajuu.net> | 2026-05-23 01:07:14 +0000 |
|---|---|---|
| committer | Estevan Castilho <tevo@riajuu.net> | 2026-05-23 01:07:14 +0000 |
| commit | db3198d7c5ad7bc60bd24bd1bb2c7b122a6dfbd0 (patch) | |
| tree | 0671ce12b98db653af87de99a443b9f83a623cb5 /lib/condition.ml | |
| parent | 2190193397596663c4de4f51f8355300c1833997 (diff) | |
| download | Sakura-db3198d7c5ad7bc60bd24bd1bb2c7b122a6dfbd0.tar.gz Sakura-db3198d7c5ad7bc60bd24bd1bb2c7b122a6dfbd0.zip | |
Include messages on on all conditions
Diffstat (limited to '')
| -rw-r--r-- | lib/condition.ml | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/lib/condition.ml b/lib/condition.ml index 67915b6..9c98df0 100644 --- a/lib/condition.ml +++ b/lib/condition.ml @@ -12,10 +12,13 @@ let of_string (s : string) = new literal (Sexplib.Sexp.Atom s) let of_list (f : 'a -> serializable) (l : 'a list) : serializable = new literal (Sexplib.Sexp.List (List.map (fun e -> (f e)#as_sexp) l)) -type t = { name : string; properties : (string, serializable) BatMap.t } +type t = { name : string; + message : string; + properties : (string, serializable) BatMap.t } -let condition name ?parent props = +let condition name message ?parent props = { name; + message; properties = parent |> Option.map (fun { properties; _ } -> properties) @@ -26,13 +29,13 @@ let ( |=| ) name value = (fun p -> BatMap.add name value p) let ( & ) l r = (fun p -> r (l p)) let empty = (fun p -> p) -let to_sexp { name; properties } = +let to_sexp { name; message; properties } = let open Sexplib.Sexp in let properties' = BatMap.to_seq properties |> BatSeq.map (fun (k, v) -> List [Atom k; v#as_sexp]) |> BatList.of_seq in - List (Atom name :: properties') + List (Atom name :: Atom message :: properties') let to_string e = (* FIXME *) Sexplib.Sexp.to_string_hum (to_sexp e) |
