about summary refs log tree commit diff stats
path: root/lib/day.ml
blob: ae5a2bdb1b3ed4f1e6cfbd7303c41bb33a2b88ad (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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