Checking
is a trait (very like
EitherExtras
),
that provides (yet) a(nother) biased alternative to scala.Either
, a
'fixed' version of which is to be found
here.
This alternative is called Checked
, whose only subclasses are Okay
and Reason
.
It is for use as the return type, in place of some type, A
, wherever
an exception might otherwise be thrown and a more 'functional' style
is preferred. Thus, a Checked[A, R]
will contain either an A
wrapped in an instance of Okay
or else an R
wrapped in an instance
of Reason
, depending on whether or not an exceptional condition
arose.
Note that although Checked
provides map
and flatMap
, it does not
provide filter
or withFilter
, since it was concluded that an empty
result is not appropriate.
The same 'extras' provided for scala.Either
by EitherExtras
are also
provided for Checked
by Checking
, including the ability to check
multiple values at once using the <*>
operator. Note that 'fast' and
'slow' have now become 'ff' (fail-fast) and 'fs' (fail-slowly), respectively.
for
comprehension tests
'lift' tests
<*>
tests
<*>
tests with multiple checks
case-class tests
'SaturdayNight' tests
tests involving Option
Musicans
printMusicians
org.lafros artifacts in Maven central repository
org.lafros artifacts in Sonatype mirror