about summary refs log tree commit diff stats
path: root/lib/day.ml
diff options
context:
space:
mode:
Diffstat (limited to 'lib/day.ml')
-rw-r--r--lib/day.ml21
1 files changed, 21 insertions, 0 deletions
diff --git a/lib/day.ml b/lib/day.ml
new file mode 100644
index 0000000..ae5a2bd
--- /dev/null
+++ b/lib/day.ml
@@ -0,0 +1,21 @@
+module type S = sig
+  val run : ?only_part1:bool -> ?only_part2:bool -> string -> unit
+end
+
+module type Impl = sig
+  type t
+
+  val parse : string -> t
+
+  val part1 : t -> unit
+
+  val part2 : t -> unit
+end
+
+module Make (Impl : Impl) : S = struct
+  let run ?(only_part1 = false) ?(only_part2 = false) inputs =
+    let parsed = Impl.parse inputs in
+    let () = if not only_part2 then Impl.part1 parsed in
+    let () = if not only_part1 then Impl.part2 parsed in
+    ()
+end