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

Adopt functional error management #11

Open
Blond11516 opened this issue Apr 30, 2023 · 2 comments
Open

Adopt functional error management #11

Blond11516 opened this issue Apr 30, 2023 · 2 comments

Comments

@Blond11516
Copy link
Collaborator

Errors are currently handled through the use of exceptions. Because Elixir is a functional language, I think it would make contributions easier if they were handled in a manner more similar to what elixir developers are used to.

I would suggest using a result monad, since pattern matching on tuples doesn't have great support in Javascript.

Will have to investigate whether to write this monad manually or import a functional programming dependency.

@Blond11516
Copy link
Collaborator Author

Thinking more about this, monads probably aren't the best idea because Elixir developers aren't really used to the concept.

Errors are rather usually handled through pattern matching, with and the like. Pattern matching isn't available in javascript, so some more thought will be required to find something that matches the Elixir experience as closely as possible.

@scottming
Copy link
Collaborator

You can take a look at the fp.ts, I used it before, its awesome.

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