Skip to content
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

Feature request: R.raise #31

Open
jakobkolb opened this issue Nov 4, 2022 · 1 comment
Open

Feature request: R.raise #31

jakobkolb opened this issue Nov 4, 2022 · 1 comment

Comments

@jakobkolb
Copy link
Collaborator

jakobkolb commented Nov 4, 2022

I know, this thing was an open an shut case in ramda.js (ramda/ramda#1317) and it would be much nicer to handle this kind of control flow with a Maybe type. But since no such thin exists in python afaik, how about we sidestep and implement something like this anyway?

def raise(e):
    def foo(*_):
        raise(e)
    return foo

I for sure would find it useful.

Cheers!

@slavaGanzin
Copy link
Owner

@jakobkolb raise is already a function in python. Why do you need this if you can R.when(R.identity, lambda: raise(Exception("It's an error"))('error?')

p.s. Sorry that i didn't respond for a year :)

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