[OCaml] High Intensity Training Online
1
(** Plans for stimuli, workouts, and routines. *)
2
3
module Rep_range : sig
4
type t
5
6
type error =
7
| Invalid_order of { min : int; max : int }
8
| Outside_limits of { min : int; max : int }
9
10
exception Invalid of error
11
12
val limits : int * int
13
(** HD1's 6-12 calibration limits. *)
14
15
val make : min:int -> max:int -> t
16
(** Raises [Invalid] for an invalid range. *)
17
18
val bounds : t -> int * int
19
end
20
21
(** One prescribed drive to failure. *)
22
module Stimulus : sig
23
type t
24
25
type delivery =
26
| Single of Exercise.t
27
| Pre_exhaust of { isolation : Exercise.t; compound : Exercise.t }
28
(** No pause between movements. *)
29
30
type error =
31
| Not_a_pre_exhaust of { isolation : Exercise.id; compound : Exercise.id }
32
| Substitute_not_permitted of Exercise.id
33
34
val pp_error : Format.formatter -> error -> unit
35
36
exception Invalid of error
37
38
val make :
39
delivery:delivery ->
40
rep_range:Rep_range.t ->
41
allowed_substitutes:Exercise.t list ->
42
t
43
(** Raises [Invalid] for an invalid pairing or substitution. *)
44
45
val delivery : t -> delivery
46
val rep_range : t -> Rep_range.t
47
val allowed_substitutes : t -> Exercise.t list
48
49
val exercises : t -> Exercise.t list
50
(** Performance order. *)
51
52
val permits : t -> Exercise.t -> bool
53
val pp : Format.formatter -> t -> unit
54
end
55
56
(** Ordered prescribed stimuli. *)
57
module Workout : sig
58
type t
59
type error = Empty_workout
60
61
exception Invalid of error
62
63
val make : name:string -> stimuli:Stimulus.t list -> t
64
(** Raises [Invalid Empty_workout] for an empty workout. *)
65
66
val name : t -> string
67
val stimuli : t -> Stimulus.t list
68
val pp : Format.formatter -> t -> unit
69
end
70
71
(** A workout cycle and its recovery intervals. *)
72
module Routine : sig
73
type t
74
type error = Empty_routine
75
76
exception Invalid of error
77
78
val make : name:string -> workouts:Workout.t list -> t
79
(** Raises [Invalid Empty_routine] for an empty routine. *)
80
81
val name : t -> string
82
83
val workouts : t -> Workout.t list
84
(** Cycle order. *)
85
86
val workout_after : t -> Workout.t -> Workout.t
87
(** Wraps; unknown workouts fall back to the first. *)
88
89
val pp : Format.formatter -> t -> unit
90
91
val training_interval : Recovery.duration
92
(** 48h. *)
93
94
val cycle_rest : Recovery.duration
95
(** 72h after the final workout. *)
96
97
val recovery_after : t -> Workout.t -> Recovery.duration
98
99
val ideal : t
100
(** The supplied Heavy Duty I routine. *)
101
end
102