Fin, Try, and IO applicative behaviours + minor fixes
Pre-releaseA question was asked about why Fin
doesn't collect errors like Validation
when using applicative Apply
, seeing as Error
(the alternative value for Fin
) is a monoid. This seems reasonable and has now been added for the following types:
Fin<A>
FinT<M, A>
Try<A>
TryT<M, A>
IO<A>
Eff<A>
Eff<RT, A>
I extended this for Try
, IO
, and Eff
because their alternative value is also Error
, so it makes sense in applicative scenarios.
The IO
monad has also had its Apply
internals updated to work with the new underlying IOAsync
, IOSync
, ... types. It now uses regular Task.WhenAll
instead of forking to achieve concurrent execution. To achieve genuine parallel execution you can still call Fork
on the operands.
IO
has also had its Zip
functions updated to use Apply
instead of forking for the same reasons. That means forking of an IO operation is a choice by the programmer rather than something that is imposed in certain functions.
Because Eff<RT, A>
and Eff<A>
are both based on the IO monad they're also updated to this new behaviour.
Domain Type traits
Minor fixes to the Domain-Type interfaces:
In Locus<SELF, SCALAR, DISTANCE>
, I have reordered the SCALAR
and DISTANCE
types and renamed SCALAR
to SCALAR_DISTANCE
; that means the new type is: Locus<SELF, DISTANCE, DISTANCE_SCALAR>
-- so it's obvious that it's a scalar value for the distance rather than SELF
. Also, removed Origin
and now rely on the AdditiveIdentity
from IAdditiveIdentity
.
Credit card validation sample
Added a new Credit Card Validation sample, this is the example built in my Higher Kinds in C# series with all of the data-types converted to use the Domain Type traits.