Skip to content

Look into returns library for higher-kinded types #880

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

Open
cosmicBboy opened this issue Jun 25, 2022 · 3 comments
Open

Look into returns library for higher-kinded types #880

cosmicBboy opened this issue Jun 25, 2022 · 3 comments

Comments

@cosmicBboy
Copy link
Collaborator

https://returns.readthedocs.io/

Use case: for the model.SchemaModel class, we want to be able to support higher kinded types in methods e.g. the validate method, such that it can return type-varying generics based on the type of the check_obj argument.

https://returns.readthedocs.io/en/latest/pages/hkt.html

@ericfeunekes
Copy link

What about, eg, returning a Result from Validate? That would allow the user to do something with the Failure, like log the failed df for examination.

@cosmicBboy
Copy link
Collaborator Author

cosmicBboy commented Nov 22, 2022

I'm guessing Success type would be a breaking change? i.e. I get a Success object instead of a DataFrame, right?

I'd hesitate to introduce this breaking change until perhaps version 1.* of pandera, or perhaps introduce a different method that implements this behavior.

@ericfeunekes
Copy link

ericfeunekes commented Nov 23, 2022

Definitely a breaking change and likely not something you'd want as a default. Most people probably wouldn't be expecting it.

But it could be implemented either as a return_monad: bool argument in validate; or even easier like you said is a separate method that just wraps validate in a try ... except ... and returns a Result in either case. The Failure case could also return the df of failing values for the user to do something with.

I'm not super familiar with the source code so there may be a better way to implement, but that's off the top of my head.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants