Hacker Newsnew | past | comments | ask | show | jobs | submitlogin
Test Spies in Haskell (jezenthomas.com)
11 points by yakshaving_jgt 12 months ago | hide | past | favorite | 4 comments


Seems like a clumsy version of dependency injection in Haskell to me.


I don’t see what’s clumsy about it. Is it that ‘stub’ seems to be part of the non-test API and gets exposed in production?

I’m not sure why this isn’t just called mock-testing.

In Scala using tagless final, I’ve seen an entire database layer get mocked. It seems like you can substitute a layer of an effect system if you go beyond the three-layer cake model. Not sure it’s warranted, never did Haskell in production.


> I’m not sure why this isn’t just called mock-testing.

A mock is a different kind of test double.

https://en.wikipedia.org/wiki/Test_double


Could you propose an alternative approach?




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: