0.x to 1.x
dejafu-1.0.0.0 is a super-major release which breaks compatibility with dejafu-0.x quite significantly, but brings with it support for bound threads, and significantly improves memory usage in the general case.
Highlights reel:
- Most predicates now only need to keep around the failures, rather than all results.
- Support for bound threads (with concurrency-1.3.0.0).
- The
ST/IOinterface duplication is gone, everything is now monadic. - Function parameter order is closer to other testing libraries.
- Much improved API documentation.
See the changelogs for the full details.
ST and IO functions
There is only one set of functions now. Testing bound threads requires being
able to fork actual threads, so testing with ST is no longer possible. The
ConcST type is gone, there is only ConcIO.
For dejafu change:
autocheckIOtoautocheckdejafuIOtodejafudejafusIOtodejafusautocheckWayIOtoautocheckWaydejafuWayIOtodejafuWaydejafusWayIOtodejafusWaydejafuDiscardIOtodejafuDiscardrunTestMtorunTestrunTestWayMtorunTestWay
If you relied on being able to get a pure result from the ConcST functions,
you can no longer do this.
For hunit-dejafu and tasty-dejafu change:
testAutoIOtotestAutotestDejafuIOtotestDejafutestDejafusIOtotestDejafustestAutoWayIOtotestAutoWaytestDejafuWayIOtotestDejafuWaytestDejafusWayIOtotestDejafusWaytestDejafuDiscardIOtotestDejafuDiscard
Function parameter order
Like HUnit, the monadic action to test is now the last parameter of the testing functions. This makes it convenient to write tests without needing to define the action elsewhere.
For dejafu change:
dejafu ma (s, p)todejafu s p madejafus ma pstodejafus ps madejafuWay way mem ma (s, p)todejafuWay way mem s p madejafusWay way mem ma pstodejafuWay way mem ps madejafuDiscard d way mem ma (s, p)todejafuDiscard d way mem s p ma
For hunit-dejafu and tasty-dejafu change:
testDejafu ma s ptotestDejafu s p matestDejafus ma pstotestDejafus ps matestDejafuWay way mem ma s ptotestDejafuWay way mem s p matestDejafusWay way mem ma pstotestDejafusWay way mem ps matestDejafuDiscard d way mem ma s ptotestDejafuDiscard d way mem s p ma
Predicates
The Predicate a type is now an alias for ProPredicate a a, defined like so:
data ProPredicate a b = ProPredicate
{ pdiscard :: Either Failure a -> Maybe Discard
-- ^ Selectively discard results before computing the result.
, peval :: [(Either Failure a, Trace)] -> Result b
-- ^ Compute the result with the un-discarded results.
}
If you use the predicate helper functions to construct a predicate, you do not need to change anything (and should get a nice reduction in your resident memory usage). If you supply a function directly, you can recover the old behaviour like so:
old :: ([(Either Failure a, Trace)] -> Result a) -> ProPredicate a a
old p = ProPredicate
{ pdiscard = const Nothing
, peval = p
}
The alwaysTrue2 helper function is gone. If you use it, use alwaysSameOn or
alwaysSameBy instead.
Need help?
- For general help talk to me in IRC (barrucadu in #haskell) or shoot me an email (mike@barrucadu.co.uk)
- For bugs, issues, or requests, please file an issue.