Good post Wouter. A message to readers..
Charlie Koster

Thanks Charlie! Sharing you particular use case is really helpful.

My use case: I have several related record type aliases in a homework planning app:

  • Exams: subjects (like French or Math) to study for, which include date of the exam
  • ExamItems: chapters or books to study, which include length in pages and reference (ID) to an Exam
  • TimeSlots: dates+times in the diary to study for an particular exam, which includes duration and reference (ID) to Exam
  • (derived) StudyItems: a whole or part of an ExamItemto study during a particular TimeSlot

Users have different ways of viewing this info: they can see all ExamItems they need to study for an exam. Or they can view a calendar, where they can see all TimeSlots for different Exams.

Updating ExamItems (e.g. reordering them) will impact their planning (what they need to study when). Updating the TimeSlots will also impact the planning.

I wish the Elm compiler would provide baked-in setter functions too.

It would save us from a lot of boilerplate. And I also struggle where to put these helpers: it doesn’t feel right to put functions in the same module where I define my types.

An alternative I dream of is some elm-jitsu magic in Atom (elm-jitsu rocks BTW!),

which would generate my boilerplate setters for a selected custom record type.

Like what you read? Give Wouter In t Velt a round of applause.

From a quick cheer to a standing ovation, clap to show how much you enjoyed this story.