123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120(* Copyright (c) 2026, Cargocut and the Lunar developers.
All rights reserved.
SPDX-License-Identifier: BSD-3-Clause *)typet=|Mon|Tue|Wed|Thu|Fri|Sat|Suntypeerror=|Invalid_weekday_numberofint|Invalid_weekday_stringofstringletall=[Mon;Tue;Wed;Thu;Fri;Sat;Sun]letto_int=function|Mon->0|Tue->1|Wed->2|Thu->3|Fri->4|Sat->5|Sun->6;;letfrom_int=function|0->OkMon|1->OkTue|2->OkWed|3->OkThu|4->OkFri|5->OkSat|6->OkSun|n->Error(Invalid_weekday_numbern);;letto_string=function|Mon->"monday"|Tue->"tuesday"|Wed->"wednesday"|Thu->"thursday"|Fri->"friday"|Sat->"saturday"|Sun->"sunday";;letto_short_string=function|Mon->"mon"|Tue->"tue"|Wed->"wed"|Thu->"thu"|Fri->"fri"|Sat->"sat"|Sun->"sun";;letfrom_stringstr=matchString.(trim@@lowercase_asciistr)with|"mon"|"monday"->OkMon|"tue"|"tuesday"->OkTue|"wed"|"wednesday"->OkWed|"thu"|"thursday"->OkThu|"fri"|"friday"->OkFri|"sat"|"saturday"->OkSat|"sun"|"sunday"->OkSun|s->Error(Invalid_weekday_strings);;letsucc=function|Sun->Mon|wd->from_int(succ@@to_intwd)|>(* NOTE: [Sun] case is guarded so [get_ok] is safe. *)Result.get_ok;;letpred=function|Mon->Sun|wd->from_int(pred@@to_intwd)|>(* NOTE: [Mon] case is guarded so [get_ok] is safe. *)Result.get_ok;;letequalab=leta=to_intaandb=to_intbinInt.equalab;;letcompareab=leta=to_intaandb=to_intbinInt.compareab;;moduleCE=structtypenonrect=tletequal=equalletcompare=compareendincludeUtil.Make_compare_helpers(CE)moduleInfix=structincludeUtil.Make_equal_infix(CE)includeUtil.Make_compare_infix(CE)endmoduleMap=Stdlib.Map.Make(CE)moduleSet=Stdlib.Set.Make(CE)includeInfix