[Haskell-cafe] Mocking out external services

Francesco Ariis fa-ml at ariis.it
Sun May 19 17:08:01 UTC 2019

Hello Matt,

On Sun, May 19, 2019 at 09:17:50AM -0600, Matt wrote:
> I would suggest that `MonadTime` and `MonadKeys` are not great choice for a
> Layer 2 - it would be really difficult to write a mock for MonadKeys that
> was in any way meaningful. I'd suggest restricting these classes to be
> tightly coupled to your domain problem. Instead of getting random keys, try
> a sum-type with all the possible things you'd prompt the user for, and a
> type for possible user responses. This is much easier to mock meaningfully.

excellent explanation and excellent suggestions, many thanks

More information about the Haskell-Cafe mailing list