https://gist.github.com/snoyberg/20243aae347b38ad09daaf8b129e2efb

It's got some magic values in a few places (especially that 65!)

Off topic, but sometimes when I find myself using magic values I can't/won't get rid off, I'll just apply the good old habits learned in Java times. For example you might find a section at the top of a file with things like

	_DAYS_IN_A_WEEK_ , _KNOWN_SIZE_OF_POINT_ :: INT

	-- | Seems to be a good approximation for now
	_DAYS_IN_A_WEEK_ = 7

	-- | When you ask "What's the point", this will not answer your question.
	_KNOWN_SIZE_OF_POINT_ = 65

Uppercase makes it easy to identify these as constants/magic values. The underscore in front works as an initial lowercase letter so they can be used as values despite uppercase.

The goal is not necessarily to make these values easy to change, but to add documentation to usage sites.

It's unnecessary In such a quick demonstration, but I wanted to take the opportunity to throw in my _VALUE_OF_CONTRIBUTION_IN_CENTS_ cents because I haven't seen others do something like this.


Cheers,
MarLinn


PS: The underscore does introduce its own error message though.

    • Found hole: _VALUE_OF_CONTRIBUTION_IN_CENTS_ :: Double
      Or perhaps ‘_VALUE_OF_CONTRIBUTION_IN_CENTS_’ is mis-spelled, or not in scope