I have to admit the current mechanism implementation makes me uneasy.
Everything is mutable and some functions, like underfundedPatrons, do
too much, making it hard to test and even follow.

When I start a new Haskell program, I usually try to express the core
idea with types, making illegal states unrepresentable.  Then, I write
pure functions connecting the said types together, which compute the
result.  IO is only used on the edges (to receive and send the data).
This is a very common technique.  Can't we use it for the mechanism?

How do you feel about this?  I think the first step should be the
rigorous spec of the things we care about, i.e., anything touching
money.  Then we follow the process described above.  Testing becomes
trivial because the core stuff is pure while IO actions are just
reads/writes.
_______________________________________________
Dev mailing list
[email protected]
https://lists.snowdrift.coop/mailman/listinfo/dev

Reply via email to