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

Added maybe function #299

Closed
wants to merge 1 commit into
base: master
from

Conversation

Projects
None yet
3 participants
@JustusAdam

JustusAdam commented Jul 16, 2015

I'd really like to get the maybe function back. In Haskell I tend to use it a ton.

@JustusAdam JustusAdam changed the title from Added meybe function to Added maybe function Jul 16, 2015

@texastoland

This comment has been minimized.

Show comment
Hide comment
@texastoland

texastoland Jul 17, 2015

I think,

map (+1) (fromString x) `withDefault` 0

reads better than,

maybe (+1) 0 (fromString x) -- flipped order

for Elm's target user coming from JS. I bet it already exists in another package though?

texastoland commented Jul 17, 2015

I think,

map (+1) (fromString x) `withDefault` 0

reads better than,

maybe (+1) 0 (fromString x) -- flipped order

for Elm's target user coming from JS. I bet it already exists in another package though?

@texastoland

This comment has been minimized.

Show comment
Hide comment
@texastoland

texastoland Jul 17, 2015

Check out Maybe.Extra's default operator:

map (+1) (fromString x) ? 0

texastoland commented Jul 17, 2015

Check out Maybe.Extra's default operator:

map (+1) (fromString x) ? 0
@evancz

This comment has been minimized.

Show comment
Hide comment
@evancz

evancz Jul 17, 2015

Member

I think map ((+) 1) maybe ? 0 is preferable over this. We have #216 to track that, but as @dnalot says, you can use it in Maybe.Extra until we make a decision about moving it into core.

Member

evancz commented Jul 17, 2015

I think map ((+) 1) maybe ? 0 is preferable over this. We have #216 to track that, but as @dnalot says, you can use it in Maybe.Extra until we make a decision about moving it into core.

@evancz evancz closed this Jul 17, 2015

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment