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

Add applicative do notation #2966

Open
janmasrovira opened this issue Aug 21, 2024 · 0 comments
Open

Add applicative do notation #2966

janmasrovira opened this issue Aug 21, 2024 · 0 comments
Labels

Comments

@janmasrovira
Copy link
Collaborator

janmasrovira commented Aug 21, 2024

Applicative do notation is similar to monadic do notation with a few differences:

  1. Only pure expressions and bind statements are allowed. I.e., there are no let statements.
  2. Last statement must be of the form pure lastExpr. We could discuss how to handle this. Maybe the pure could be implicit.
  3. Variables bound in a bind statement are only in scope of the last expression in the block.
  4. We use a different keyword. E.g. ado.
ado {
  opt1 <- getOpt1
  opt2 <- getOpt2 -- opt1 is not in scope here
  pure Options.mk@{
    opt1;
    opt2;
  }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant