I am trying to insert a string into a record type, which is a list of strings. However, the semicolon after the record keeps throwing an error. Also a couple of lines down there's a type error that I think is related because as I've been playing around with debugging the first error sometimes it goes away. Deleting the semicolon, adding or deleting "...", "_", or the entire record hasn't worked and often only causes more errors.
if (lecture.time == workweek.time) {
switch (lecture.priority, workweek.priority) {
| (3, 1) => failwith("No time available for class")
| (3, 2) =>
switch (lecture.day) {
| "monday" => {monday: [lecture.lecture], ...};
| "tuesday" => {..., tuesday: [lecture.lecture], ...};
| "wednesday" => {..., wednesday: [lecture.lecture], ...};
| "thursday" => {..., thursday: [lecture.lecture], ...};
| "friday" => {..., friday: [lecture.lecture]};
| _ => failwith ("not a valid day")
The errors:
Error: Syntax error
Error: This pattern matches values of type string
but a pattern was expected which matches values of type (int, int)
Record update syntax is
{...rec, field: value}: https://reasonml.github.io/docs/en/record#updating-records-amp-spreadingIn your case it should probably be:
But it's difficult to be sure without knowing the definition of the record type. You should also list the errors next to the specific code that throws each error, not lump them together. It's difficult to tell which code is causing which error.