google-research / google-research/dex-lang

Use < > brackets for effects

Open
#787 5 comments 2 reactions 0 assignees View on GitHub
language / concrete syntax
Dominant language
Haskell
Stars
1.7k
Forks
116
PR merge metrics
No merged PRs in 30d

Description

With the introduction of using `{}` in type signatures to implicitly quantify over variables, there are now 3 distinct uses of curly braces that all show up in type signatures:

1. implicit quantification
2. records
3. effects

The effect syntax also uses vertical bars `|`, which make their syntax confusingly close to that of variants. For example, here are two different type signatures in the prelude:

One to do with effects:
```
def liftState {a b c h eff} (ref: Ref h c) (f:a -> {|eff} b) (x:a) : {State h|eff} b =
```

One to do with variants:
```
Iso {foo: a | ...b} (a | {|...b}))
```

So I suggest we use angle brackets `< >` for effects. They aren't used at all in the current syntax. They would also give a more explicit nod to Koka for developing some of these ideas.

Contributor guide

Open the contributing guide

Research direction

No files, tests, or entry points are named. Begin by locating the parser and type-signature handling for effects and variants, then review how syntax changes are tested; done means effect signatures use angle brackets without ambiguity with records, quantification, or variants.

Written by the indexing model from the issue text.

Assessment

Domain
compilers
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.