¿ªÔÆÌåÓý

ctrl + shift + ? for shortcuts
© 2025 Groups.io

Re: TDD in type-checked FP languages


 

¿ªÔÆÌåÓý

Except for IO monads are values like anything else, at least in Haskell so ¡°testing monads¡± usually amounts to testing functions.
For fine grained tests I try to avoid IO and use either the Handler pattern to group all IO actions together, or a custom implementation of a type class if I use mtl style.

Arnaud?

Envoy¨¦ de mon iPhone

Le 22 f¨¦vr. 2021 ¨¤ 00:53, J. B. Rainsberger <me@...> a ¨¦crit?:

?
On Sat, Feb 20, 2021 at 1:12 PM Gregory Salvan <apieum@...> wrote:

I never want test doubles, but I also rarely want end-to-end tests. Of course, there are no "stubs" in FP, but merely functions that return hardcoded values.

How do you test your edges ? your monads ?

I don't write monads yet, at least not intentionally. I presume that if I write them, then I use the equivalent of stubs, except that they aren't really stubs, but rather just functions as parameters. I treat them in my mind like OOP interfaces.

As for edges, I presume you mean the point of integration with something outside of the system? I write Learning Tests for the thing outside the system, which are usually integrated tests, and then at the point of integration I choose whether to integrate with the real thing or with a function that invokes the real thing.
--
J. B. (Joe) Rainsberger :: ?:: ::


--
J. B. (Joe) Rainsberger :: :: ::
Teaching evolutionary design and TDD since 2002

Join [email protected] to automatically receive all group messages.