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

Can MonadFix help eliminate need for newX/defineX split? #41

Open
jberryman opened this issue Nov 7, 2012 · 4 comments
Open

Can MonadFix help eliminate need for newX/defineX split? #41

jberryman opened this issue Nov 7, 2012 · 4 comments

Comments

@jberryman
Copy link

I'm just starting to explore the module, so not sure it makes sense in this case, but I know it was the answer for me when I encountered a similar API design problem. GHCs DoRec extension lets you do things like this for monads with a MonadFix instance, like IO:

do rec a <- somethingWith b
       b <- somethingWith a
       c <- foo c
    etc
@NathanHowell
Copy link
Collaborator

Yes, I believe so. I'm not much of a fan of the split either... any chance you could put together a patch?

@NathanHowell
Copy link
Collaborator

I added derived MonadFix instances in 0b04245... if you have a chance to try them out that'd be great.

@amigalemming
Copy link

Can someone explain, what the problem is? MonadFix on IO sounds strange to me.

@jberryman
Copy link
Author

Sorry to be out of touch on this! I'd like to try my hand at this but may
not be able to make the time for it in the very near future. Im also not a
real user od this lib yet.

In the meantime a concrete example of the same kind of thing is in a
package I have called simple-actors. Where monadfix eliminates the need for
separate "create mailbox" and "run on mailbox" and allows spawn to do
both, leaving us with a simpler API that we can't use incorrectly (e.g.
running two different actors on the same mailbox or "mailbox token" would
be wrong)

I added derived MonadFix instances in
0b042450b04245...
if you have a chance to try them out that'd be great.


Reply to this email directly or view it on
GitHubhttps://github.com//issues/41#issuecomment-17921478
.

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

3 participants