4 patches for repository https://darcs.net/screened:
patch 9869d614ff789fa57d554ad1996e85d99e6fc116
Author: Ben Franksen <ben.franksen@online.de>
Date: Fri Apr 22 08:51:13 CEST 2022
* Prim.V1: inline isInDirectory and isSuperdir
patch cbcc171edd595d725ac377141d488d7688451e7b
Author: Ben Franksen <ben.franksen@online.de>
Date: Fri Apr 22 08:57:38 CEST 2022
* Prim.V1: simplify some commute cases
These simplifications are due to f == g => f `isPrefix` g. This refactor is
pure boolean logic.
patch 91387a15fe3b42aa70c3f91d2b45fac0d4613114
Author: Ben Franksen <ben.franksen@online.de>
Date: Fri Apr 22 09:10:22 CEST 2022
* Prim.V1: in commuteFiledir use guard style for all clauses
Again a pure refactor for readability.
patch 55d1c8720e84d9d169cdb70f0614e10cdb808393
Author: Ben Franksen <ben.franksen@online.de>
Date: Tue Apr 26 11:58:58 CEST 2022
* Prim.V1: list all cases explicitly
This removes the Perhaps data type, speedyCommute, and
everythingElseCommute, and renames cleverCommute to invertCommute.
The complication introduced by the Perhaps data type with an extra Unknown
constructor was only there to save a few case distinctions. Listing them
explicitly is clearer and adds only a few lines of code which can be easily
seen to be correct as they are all generically implemented in terms of
invertCommute, exactly as before. The questionable speedyCommute is no
longer used: it doesn't actually optimize anything since it merely
duplicates parts of the first case of commuteFileDir. Finally, moving the
two extra cases for ChangePref patches from everythingElseCommute into
commuteFileDir allows us to avoid any fall-through wildcard case, making the
code more robust and proving that all cases are handled. The extra cases for
commuteFP (instead of a single fall-through case) are also meant to improve
clarity and robustness; their common implementation (failed) follows
logically from the combination of how the former cleverCommute and toMaybe
functions handled Unknown results.
Attachments
|