HMock icon indicating copy to clipboard operation
HMock copied to clipboard

Work out how to use HMock with HAXL

Open cdsmith opened this issue 3 years ago • 0 comments

See #4.

Haxl isn't exactly an effect system, but it's a technology that can be used to define and use APIs for talking to external systems. That makes it a good fit for mocking, and I'd like HMock to work well with it.

Haxl data sources already define their own Request types, which are GADTs much like HMock actions. However, the Haxl request type lacks the operation name in the type, which makes it unsuitable for use with HMock in the current design. At the cost of some type-safety loss, we could conceivably redesign to make it possible to use Haxl requests directly as actions.

Haxl already allows plugging in data source implementations at runtime, to facilitate fake data sources. We just need HMock to be able to generate such a fake data source from a request type. This means that the implementation must use a Haxl StateKey for the mock state instead of the MockT monad transformer, which means we'll need to generalize the infrastructure a bit.

cdsmith avatar Jul 19 '21 22:07 cdsmith