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

Feature/multieffects #13

Merged
merged 10 commits into from
Apr 7, 2020
Merged

Feature/multieffects #13

merged 10 commits into from
Apr 7, 2020

Conversation

b-studios
Copy link
Collaborator

Implement multi effects.

For now we decided on the following syntax.

Effect declarations

effect State {
  def get(): Int
  def set(n: Int): Unit
}

Effect calls

do get()

Effect handling

try { ... } with State {
  def get() = resume(4)
  def set(n: Int) = ...
}

Shorthands

There are also shorthands for singleton operations

effect Foo(): Unit

currently expands to

effect Foo {
  def Foo(): Unit
}

and

try { ... } with Foo { () => ... }

expands to

try { ... } with Foo { 
  def Foo() => ... 
}

@b-studios
Copy link
Collaborator Author

Mentioning the effect type on handling has the advantage that later, we can bind type parameters there.

@b-studios
Copy link
Collaborator Author

Great! Thanks for updating the examples and tests!

@b-studios b-studios merged commit 44a4171 into master Apr 7, 2020
@b-studios b-studios mentioned this pull request Apr 7, 2020
@b-studios b-studios deleted the feature/multieffects branch April 8, 2020 19:05
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

Successfully merging this pull request may close these issues.

2 participants