3 ms·
That feels even more wrong for Haskell. I think that the Haskell way really is that you have pass the function in. Probably the worst thing about Haskell is tha
by jerf 16y ago
That feels even more wrong for Haskell. I think that the Haskell way really is that you have pass the function in. Probably the worst thing about Haskell is that it aggressively has no concept of a global environment.
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".
- kwantam 16y agoI can see your point here, but since time is fundamentally an external datum provided by the system, in my view there's no reason to screw with Haskell's internals when you can just produce the necessary simulated environment in which your runtime lives. Moreover, by doing it this way you can use exactly the same code in testing as in production, reducing the risk of something going wrong when you change from the former to the latter codebase.
- kunley 16y agoI totally agree. The OP came with a great way of simulating certain states of the external environment for the purpose of tests and completely independently of the implementation. This decoupling seems uber cool.