purescript-contrib / purescript-quickcheck-laws

QuickCheck powered law tests for PureScript's core typeclasses.
MIT License
25 stars 18 forks source link

Check through Aff #44

Open dakom opened 6 years ago

dakom commented 6 years ago

This is more a question than an issue. Apologies if this is the wrong place to ask!

How do you test a functor which can only get its value after some time - i.e. say I can get it either by supplying a callback, or getting an Aff?

In other words, I believe I need to define Eq for the tests, but Eq is synchronous - how can I do it async?

garyb commented 6 years ago

I think in Haskell there's a Monadic module or something that supports testing effectful code, we'd probably need something like that to make a version of the law tests that can work for the kind of thing you're describing.

I'm not too sure really - when it comes to testing effectul code I tend to write unit tests instead, as unless the effects are benign, or based on State or some other kind of deterministic effect, the test will be relying on a bit more than just the property holding.