
Tech Talk: Domain Driven Design meets Functional Programming
CoRecursive: Coding Stories
00:00
How to Write Tests for a Monad
The usual technique which i follow is that whenever i write implementation for an abstraction, i keep an eye on the testability part of it. If you kind of think of future as amonad, which people tend to think of, then it's better to have your algebra defined in terms of a monad instead of a future. And for the testing part of it, you can specialize the monad as an identity monad. So in that way, your test coat becomes much more simpler. It becomes much easily testable, without any of the engineering or any of the intricacies having to deal with execution contexts and futures.
Transcript
Play full episode