diff options
Diffstat (limited to 'lib/kernel')
| -rw-r--r-- | lib/kernel/colour.ml | 14 | ||||
| -rw-r--r-- | lib/kernel/colour.mli | 6 | ||||
| -rw-r--r-- | lib/kernel/subject.ml | 13 | ||||
| -rw-r--r-- | lib/kernel/subject.mli | 6 |
4 files changed, 39 insertions, 0 deletions
diff --git a/lib/kernel/colour.ml b/lib/kernel/colour.ml new file mode 100644 index 0000000..c7f81c2 --- /dev/null +++ b/lib/kernel/colour.ml @@ -0,0 +1,14 @@ +(* Liturgical colours. Shared across Roman rites (spec ยง2.1): not + rite-parametric, because EF and OF use the same six. *) +type t = White | Red | Green | Violet | Rose | Black [@@deriving sexp] + +let all = [ White; Red; Green; Violet; Rose; Black ] + +let to_string = function + | White -> "white" | Red -> "red" | Green -> "green" + | Violet -> "violet" | Rose -> "rose" | Black -> "black" + +let of_string = function + | "white" -> Some White | "red" -> Some Red | "green" -> Some Green + | "violet" -> Some Violet | "rose" -> Some Rose | "black" -> Some Black + | _ -> None diff --git a/lib/kernel/colour.mli b/lib/kernel/colour.mli new file mode 100644 index 0000000..f419ecb --- /dev/null +++ b/lib/kernel/colour.mli @@ -0,0 +1,6 @@ +(** Liturgical colours, shared by all Roman rites. *) +type t = White | Red | Green | Violet | Rose | Black [@@deriving sexp] + +val all : t list +val to_string : t -> string +val of_string : string -> t option diff --git a/lib/kernel/subject.ml b/lib/kernel/subject.ml new file mode 100644 index 0000000..000aaff --- /dev/null +++ b/lib/kernel/subject.ml @@ -0,0 +1,13 @@ +(* Whom the celebration is of. Named [Subject] rather than [Class] because + [class] is an OCaml keyword. Used by precedence in Plan 3 (RG 91). *) +type t = Temporal | Saint | Bvm | Lord [@@deriving sexp] + +let all = [ Temporal; Saint; Bvm; Lord ] + +let to_string = function + | Temporal -> "temporal" | Saint -> "saint" | Bvm -> "bvm" | Lord -> "lord" + +let of_string = function + | "temporal" -> Some Temporal | "saint" -> Some Saint + | "bvm" -> Some Bvm | "lord" -> Some Lord + | _ -> None diff --git a/lib/kernel/subject.mli b/lib/kernel/subject.mli new file mode 100644 index 0000000..443364d --- /dev/null +++ b/lib/kernel/subject.mli @@ -0,0 +1,6 @@ +(** Whom a celebration is of. [Temporal] is the temporal cycle's own office. *) +type t = Temporal | Saint | Bvm | Lord [@@deriving sexp] + +val all : t list +val to_string : t -> string +val of_string : string -> t option |
