I should, perhaps, remark on why I did this.
One reason is that this way of using pattern matching for the arguments
of top-level functions is abusive, IMO. It expresses a preference to
give a name to /things/, whereas the major strength of functional
programming is to give names to (small, re-usable) /functions/.
And, of course, there are the usual reasons: we can now add or remove
data members from Repository without having to change all functions that
take it as argument.
Last not least: we used pattern matching for two completely separate
reasons: (1) to get at (some of) the members and (2) to reconstruct an
identical copy with a different type, i.e. with "new" witnesses. These
two motives are now expressed with separate functions, making the
intention clear.
|