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

Not a Monad #2

Open
joneshf opened this issue Sep 20, 2015 · 3 comments
Open

Not a Monad #2

joneshf opened this issue Sep 20, 2015 · 3 comments

Comments

@joneshf
Copy link

joneshf commented Sep 20, 2015

For example:

function foo(x) {
  return x == null ? 3 : x;
}

bind(null, foo) //=> null
foo(null) //=> 3
bind(null, foo) === foo(null) //=> false
@hemanth
Copy link
Member

hemanth commented Sep 21, 2015

Hmm, How you would suggest it to be?

//cc @stoeffel

@joneshf
Copy link
Author

joneshf commented Sep 21, 2015

The simplest way is to just not claim it being a monad. It's a fine abstraction for avoiding null checking, but calling it a monad will bite someone later when they try to reason about it. Might be you, might be me (already was me actually), might be someone else, but it will happen.

@hemanth
Copy link
Member

hemanth commented Sep 21, 2015

It would be nice if you could help use define it here

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