diff options
| author | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-11 11:25:56 +0200 |
|---|---|---|
| committer | Lukasz Kasprzak <lukas@labunix.xyz> | 2026-08-11 11:25:56 +0200 |
| commit | ca289b2f43a5b097c4ec20308c1661a0c404399c (patch) | |
| tree | 09b34b4516ef299fcf6e3689cf7bcd69fa83c640 /lib/kernel/lang.mli | |
| parent | e444ae5b03a9113fc6b2fc3fa3e2fd6b71bf8d4b (diff) | |
| download | colitur-ca289b2f43a5b097c4ec20308c1661a0c404399c.tar.gz colitur-ca289b2f43a5b097c4ec20308c1661a0c404399c.zip | |
kernel: Slug and Lang validated private strings
Both parse through a smart constructor returning result, and both hand-write
t_of_sexp so a malformed value in a data file is rejected at load rather than
silently accepted -- deriving the converter would have bypassed validation.
Diffstat (limited to 'lib/kernel/lang.mli')
| -rw-r--r-- | lib/kernel/lang.mli | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/kernel/lang.mli b/lib/kernel/lang.mli new file mode 100644 index 0000000..6d26a1d --- /dev/null +++ b/lib/kernel/lang.mli @@ -0,0 +1,11 @@ +(** Two-letter lowercase ISO-639-1 language codes. The set is deliberately open: + overlays add languages as data, never as code. *) +type t = private string + +val of_string : string -> (t, string) result +val of_string_exn : string -> t +val to_string : t -> string +val compare : t -> t -> int +val equal : t -> t -> bool +val t_of_sexp : Sexplib0.Sexp.t -> t +val sexp_of_t : t -> Sexplib0.Sexp.t |
