This is what sequenceT is doing under the hood (when specialized to getValidation(getSemigroup<string>()) + three validations)
functionspecializedSequenceT(firstValidation:Either<NonEmptyArray<string>,string>,secondValidation:Either<NonEmptyArray<string>,string>,thirdValidation:Either<NonEmptyArray<string>,string>):Either<NonEmptyArray<string>,[string,string,string]>{// Applicative instance for `Either<NonEmptyArray<string>, A>`constV=getValidation(getSemigroup<string>())// builds a tuple from three stringsconsttuple=(a:string)=>(b:string)=>(c:string):[string,string,string]=>[a,b,c]// manual lifting, check out the "Lifting" section in "Getting started with fp-ts: Applicative"returnV.ap(V.ap(V.map(firstValidation,tuple),secondValidation),thirdValidation)}functionvalidatePassword(s:string):Either<NonEmptyArray<string>,string>{returnpipe(specializedSequenceT(minLengthV(s),oneCapitalV(s),oneNumberV(s)),map(()=>s))}
Ohhhh, okay, the tuple of results is what you apply to. Thank you so much for your answer!
(And yes, going back to the applicative article right now 😉)
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
Thank you so much for those articles, Fp-ts has done a lot to increase my speed everyday at work!
I'm struggling to figure what this would look like without the
sequenceT
helper. Would you have time to provide a snippet ?(I tried going through the sequenceT source but I can't quite figure out what's going on yet)
This is what
sequenceT
is doing under the hood (when specialized togetValidation(getSemigroup<string>())
+ three validations)Ohhhh, okay, the tuple of results is what you apply to. Thank you so much for your answer!
(And yes, going back to the applicative article right now 😉)