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

cons #38

Merged
merged 1 commit into from
Nov 11, 2019
Merged

cons #38

merged 1 commit into from
Nov 11, 2019

Conversation

Chadtech
Copy link

Hi,

This is a function I have in all my Util.elm files nowadays, usually with the name maybeCons. It takes a Maybe and a List and it attaches the value to the front of the list if it exists. In one example, I have an error message I want in my html only if the error exists. I use maybeCons to attach the errorView if the error is a Just Error, but not otherwise. In another instance I need to prepare a list of strings to be displayed like a console read out, and some of the information is stored as a Maybe in the model. I exclude missing information from the read out with maybeCons.

cons was actually already in the module, under the namefoldrValues, and it wasnt exposed.

Best,
-Chad

@skyqrose
Copy link
Collaborator

I like this, and would use it frequently. There were some conflicts, so I rebased it.

@skyqrose skyqrose merged commit 624ab01 into master Nov 11, 2019
@skyqrose skyqrose deleted the cons branch November 11, 2019 19:31
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

Successfully merging this pull request may close these issues.

2 participants