Fin, Try, and IO applicative behaviours + minor fixes #1365
louthy
announced in
Announcements
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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