Simulating any system date for TDD by library interposing
irekjozwiak.com
irekjozwiak.com
On the flipside, when trying to do things as securely as possible, never blindly trust dynamic linkage into library functions: attackers can and will use such techniques against you. Reflections on Trusting Trust[1] becomes scarier when you start thinking about all the venues you open with dynamic library linkage.
Here's the thing: The application would calculate the timezone based on system-A, then use the time from system-B to do a lookup into a GMT-based table using system-B's time. All well and good, until the testers tried to test calling outside allowed hours by changing their local system clocks. This mess resulted in trying to look up entries in the table for timezones the middle of the Pacific. Boom!
The worst part? Trying to explain to the testers how this was an inherent flaw in the legacy system and not a result of the upgrade. (Yes, I would've changed it if I were allowed to.)
That said this may well be the most practical approach; "the Haskell way" and "practical" are not always exactly buddy-buddy. I'm just responding to the question of "the Haskell way".