fp-ts: Validation is deprecated, but it is not explained why
š Documentation
I just looked at Validation
in the modules list, but everything is crossed out and there is a comment at the end that I should use EitherT
. There is no documentation about what EitherT
does, or what the T
stands for. It would be good if there was at least some information on these classes on how to use them, what they do, why is it deprecated, etc.
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Reactions: 2
- Comments: 15 (3 by maintainers)
Well, letās be a bit more flexible here š We also donāt have any goals for leaving consumers of this project on their own.
Documentation is hard and pretty often it is incomplete. This project is not an exception. We would like to invest more in documenting more at least the public API. Still, thereās not much resource to do that as the project is OSS. In other words, weāre always open for documentation PRs.
As for now, @adam-arold, feel free to check the Help section of the readme. The discord/slack channels there would be a better place to ask about things like
EitherT
(monad transformers) and others.@adam-arold
It was deprecated because itās a special case of
Either
. The difference betweenValidation
andEither
is that duringchain
-ing orap
-ping (in other words, combining several things)Validation
concats all errors in an instance ofSemigroup
(the simplest isArray
) whenEither
āfails-fastā discarding the rest of the computation. So the actual difference between them is the difference in the underlyingSemigroup
for errors.I was not using
fp-ts
before v2 so this is just an educated guess based on git history.fp-ts
use class-based data type. There was anValidation
data type separated fromEither
fp-ts
changed to pure data type, push the use ofpipe
function. TheValidation
data type is no more, instead there wasValidationT
(https://github.com/gcanti/fp-ts/blob/2.0.0/src/ValidationT.ts).ValidationT<M, E, A>
is justM<Either<E, A>>
with anApplicative
instance knows how to combineE
values.either.getApplicativeValidation
and thus deprecatedYou are right. And Iām waiting for an answer just like you. š
What @steida says is not errogant. You surely agree that React doesnāt need to explain HTML concepts. Also Tailwind doesnāt need to explain CSS concepts and lodash assumes their consumers know JavaScript.
fp-ts didnāt invent TypeScript or functional programming. Those two are the only two prerequisites to use the library.
Itās not errogant, itās efficient. FP is a broad subject, and there are many ways to teach it. There are links to some resources on the web.
That being said, I still think documentation can improve in many aspects.
And yes, I think there should be an explanation for why itās deprecated with a link to an alternative.