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

StringMap is an instance of Bind #5

Open
sebastian-philipp opened this issue Apr 22, 2014 · 2 comments
Open

StringMap is an instance of Bind #5

sebastian-philipp opened this issue Apr 22, 2014 · 2 comments

Comments

@sebastian-philipp
Copy link
Owner

Bind (Bindable Functor) is a Monad without return

@UweSchmidt
Copy link
Collaborator

Then we can make StringMap an instance of Monad with

return v = singleton "" v

@sebastian-philipp
Copy link
Owner Author

I don't think using an empty string as default is a good idea. Anyway, I don't think it's worth the effort

ghci Data.Functor.Bind Data.Map> fromList [("foo",5), ("bar",1)] >>- (\x -> fromList [("foo", x + 1), ("bar", x - 1), ("baz", x * 2)])
fromList [("bar",0),("foo",6)]

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