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

Generic monad algorithm #100

Open
denghz opened this issue Oct 18, 2022 · 1 comment
Open

Generic monad algorithm #100

denghz opened this issue Oct 18, 2022 · 1 comment

Comments

@denghz
Copy link
Contributor

denghz commented Oct 18, 2022

Is it possible to define a function that can handle multiple types of effects depends on the object that yields the effect?
Like in Haskell

join :: Monad m => m (m a) -> m a
join xss = 
    do xs <- xss
       xs                            

which would work for all monads including, list, maybe, io, stm, etc...
I can help about it if needed.

@dbrattli
Copy link
Owner

No, I don't think it's possible e.g an iterable join is very different from an observable join so each world will need a specific implementation. It will not be possible for the specific implementation to be registered as an auto-dispatch / overload. But if you have a suggestion then please feel free to explain what idea you have in mind.

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