No extensible records in Model #95
jfmengels
started this conversation in
Rule ideas
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
What the rule should do:
Report when extensible records are used for data. In practice, I think that will mean forbid extensible records used directly or indirectly in
Model
(andMsg
? Elsewhere?).What problems does it solve:
As Evan Czaplicki once said (as quoted by Richard Feldman in Scaling Elm Apps):
I find that code using extensible records for their data is often too coupled to where it is used, and a lot of unnecessary fields/values are necessary in places they are not needed.
Example of things the rule would report:
In this example,
User
would be reported because we don't want to store it in the model. Here, theid
field is defined but not used, but we'll need to create it to be able to create aUser
.In practice, I find that
User
is often defined in a separate module, so as to be able to re-use functions across modules, and that this increases the chance to have unused data (that needs to be fetched, initialized, ...).Example of things the rule would not report:
When (not) to enable this rule:
🤷♂️
I am looking for:
Beta Was this translation helpful? Give feedback.
All reactions