You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A 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.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
A question was asked about why
Fin
doesn't collect errors likeValidation
when using applicativeApply
, seeing asError
(the alternative value forFin
) 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
, andEff
because their alternative value is alsoError
, so it makes sense in applicative scenarios.The
IO
monad has also had itsApply
internals updated to work with the new underlyingIOAsync
,IOSync
, ... types. It now uses regularTask.WhenAll
instead of forking to achieve concurrent execution. To achieve genuine parallel execution you can still callFork
on the operands.IO
has also had itsZip
functions updated to useApply
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>
andEff<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 theSCALAR
andDISTANCE
types and renamedSCALAR
toSCALAR_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 thanSELF
. Also, removedOrigin
and now rely on theAdditiveIdentity
fromIAdditiveIdentity
.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.
This discussion was created from the release Fin, Try, and IO applicative behaviours + minor fixes.
Beta Was this translation helpful? Give feedback.
All reactions