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

Separating ParFuture and ParIVar #118

Open
osa1 opened this issue Jul 28, 2015 · 1 comment
Open

Separating ParFuture and ParIVar #118

osa1 opened this issue Jul 28, 2015 · 1 comment

Comments

@osa1
Copy link
Member

osa1 commented Jul 28, 2015

Currently ParFuture is a superclass of ParIVar. We use ParFuture superclass to make Future and IVar types same(why we need this?).

But this has some problems, for example, IVar methods don't need FutContents constraints: In the implementation of alternative schedulers we may need NFData constraint in FutContents to handle lazy exceptions, but we only need Eq in IVars etc.

So we may want to remove the superclass constraint. If we decide not to change it, at least we should document why ParFuture is a superclass of ParIVar and why we want IVars and Futures to be the same.

cc @rrnewton

@rrnewton
Copy link
Member

Originally, the idea was that these were indeed refinements of the same concept. Further, if one is writing code with IVars, it would be a pain to define a new spawn for example, which worked for IVars rather than futures, rather than just sharing the same function. (The separation vs. combination of Monad vs Applicative may serve as a point of comparison.)

The problem is that with both the IVar and Future APIs there are some choices about the semantics that we need to either decide one way or parameterize over.

  • IVars: are multiple puts of the same value allowed? (This requires an Eq instance, and relates to FutContents, Get rid of FutContents #108 )
  • Futures -- are spawned computations that diverge or throw exceptions able to affect the parent computation if the future is ever read?

I think both of these issues can be teased out by looking at which laws we want and don't want for each class. I'll start an issue specifically for discussing those laws, and we should put the ones we agree on in the comments at least.

osa1 added a commit that referenced this issue Aug 1, 2015
(Ryan's patch in dev2 branch manually applied)
@rrnewton rrnewton modified the milestone: 2.0 Release May 10, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants