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

Needs use cases and more examples #4

Open
phenax opened this issue Oct 12, 2018 · 3 comments
Open

Needs use cases and more examples #4

phenax opened this issue Oct 12, 2018 · 3 comments
Labels
docs Changes to the documentation or readme file help wanted Extra attention is needed

Comments

@phenax
Copy link
Owner

phenax commented Oct 12, 2018

No description provided.

@phenax phenax added the help wanted Extra attention is needed label Oct 12, 2018
@phenax phenax closed this as completed in #1 Oct 18, 2018
@phenax phenax reopened this Oct 20, 2018
@phenax phenax added the docs Changes to the documentation or readme file label Oct 20, 2018
@nevf
Copy link

nevf commented Apr 1, 2019

I've been trying to work through some of the examples with limited success.
For example https://github.com/phenax/enum-fp#pattern-matching works fine,

However https://github.com/phenax/enum-fp#safely-work-with-emptyinvalid-states doesn't include getUser() and I don't know what it is expected to return.

Other examples like: https://github.com/phenax/enum-fp#in-the-functional-world do not show how to actually use them.

I also tried https://gist.github.com/phenax/e841e54a2826c1d52b6dce3c493ef792#file-maybe-js from the Medium article https://medium.com/@phenax5/writing-cleaner-and-safer-javascript-with-sum-types-bec9c68ba7aa and it fails because user is not defined anywhere in Maybe.match(getFirstName(user) and I also assume that isUserValid() is missing.

For folks with a good understanding of FP some of this may not be such a problem, but for someone like me who is very new to FP I have very little understanding of many of the concepts included with enum-fp and more concrete executable examples along with more documentation would help greatly.

I have no doubt enum-fp provides some really useful tools to help with our Javascript development but this mostly alludes me right now.

@phenax
Copy link
Owner Author

phenax commented Apr 1, 2019

@nevf. Thank you for bringing up theses issues. In retrospect, I feel like I may have posted the example with a tunnel vision perspective towards functional programming.

  1. The getUser was just a function that returns a user object. I'll update the example to get rid of that to make things clearer.
  2. I'll add a description and some references to the Maybe and Either monads so everyone has a reference for how it works.
  3. user is a normal object with the firstName property. I'll define user in the example so that it is clearer.

@nevf
Copy link

nevf commented Apr 1, 2019

@phenax Many thanks, I look forward to the updates and trying the examples again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Changes to the documentation or readme file help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants