-
-
Notifications
You must be signed in to change notification settings - Fork 503
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Validation is deprecated, but it is not explained why #1569
Comments
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 |
@steida I don't see why asking about why something is deprecated and/or undocumented is related to learning FP. To be honest FP has a very steep learning curve and FP folks have a tendency to be arrogant about it. You seem to be one of those folks. If you don't want others to use FP don't create an open source library. If you create one you also carry the burden of having to properly document it and sometimes to explain how these things work. I know because I have an (unrelated) library of my own where people come on to my discord channel and ask about things. The worst possible thing you can do that will also label you and all your work with a 🚩 is to give out answers like this. |
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. |
I didn't say that @steida is arrogant. I said they seem like it, and there is a big difference. It doesn't matter if you're a paragon of humility if you don't look like one from the outside observer. Also comparing FP to CSS and HTML is not a good comparison. Literally everybody knows HTML and CSS. It goes without saying. Knowing FP is not like that, and the inherent complexity of FP vs CSS is also an order of magnitude higher. Take me for example: learning React for me was a breeze, learning Tailwind was a breeze too even though my CSS knowledge was outdated and I had to re-learn half of it. FP is a very different beast and it is hard to see this if you already know it. Case in point: I still don't know why |
You are right. And I'm waiting for an answer just like you. :) |
The alternative is calling The input of If the you model the result of validation to be declare validateName: (name: string) => either.Either<string[], string>
declare validateAge: (age: number) => either.Either<string[], number>
const Ap = either.getApplicativeValidation(array.getSemigroup<string>())
const person = apply.sequenceS({
name: validateName('abc'),
age: validateAge(10)
}) // => Either<string[], { name: string, age: number}> |
Thanks, @xuanduc987 ! What was the problem with |
And I agree that the document could be better. |
While |
So it is deprecated because there is a better solution in io-ts? |
I was not using
|
It was deprecated because it's a special case of |
Thanks for the explanation, I'll close this. |
Still very new to FP, I'm sure there's a more efficient way to do this but this worked for me:
|
according to comments in source code, here is my solution: let Ap = TE.getApplicativeTaskValidation(T.ApplyPar,
pipe(string.Semigroup, S.intercalate(", "))
)
let res = await pipe(
sequenceT(Ap)(
validateFileName(input.fileName),
validateBucket(input.bucket),
),
TE.mapLeft((it)=> Error(it)), let validateFileName = (fileName?: string): TE.TaskEither<string, string> => {
if (!fileName) return TE.left("fileName is required")
if (!fileName.match(/.*(-all|-docs|)\.zip/))
return TE.left("fileName not supported")
return TE.right(fileName)
} |
📖 Documentation
I just looked at
Validation
in the modules list, but everything iscrossed outand there is a comment at the end that I should useEitherT
. There is no documentation about whatEitherT
does, or what theT
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.The text was updated successfully, but these errors were encountered: