Skip to content

docs: a function type lists its effects inside its brackets - #87

Merged
heyJordanParker merged 2 commits into
masterfrom
docs/function-type-uses
Oct 11, 2026
Merged

heyJordanParker merged 2 commits into
masterfrom
docs/function-type-uses

Conversation

@heyJordanParker

Copy link
Copy Markdown
Owner

Problem

Spec section 29 wrote a function type's effects after its closing >, as in Function<Charge(Cart)> uses Http charge. That placement reads two ways inside a type argument list, where a comma after an effect can start the next type argument, and next to ?. Jordan ruled option 2: uses goes inside the brackets, after the parameter list.

Companion Mago PR: heyJordanParker/mago-sharp#122, which parses, binds, scans, prints and lowers the new form and refuses the old one.

Solution

Section 29's example moves its effects inside the brackets, and the section gains Jordan's four approved lines:

Function<Charge(Cart) uses Http> charge;                        // compiles
Function<Charge(Cart) uses Http>? fallback;                      // compiles
Map<string, Function<Charge(Cart) uses Http, Mail>> handlers;    // compiles: Http and Mail are both effects
Function<int(Function<int(int) uses Http>)> apply;               // compiles

Section 14.1 names the placement. Decision 6's rejected mapWithHttp example was the only other > uses on a function type in the spec and the decisions, and it moves too. Decision 71 records the ruling, with Swift's throws and Koka's effect rows as precedent and Java's throws as the rejected one.

Files

docs/
├── spec.md                                  section 14.1 names the placement; section 29's example moves and gains the four lines
└── decisions/
    ├── 006-function-argument-effects.md     the rejected example writes `Function<TResult(T) uses Http> f`
    └── 071-function-type-effects.md         new: effects go inside the function type's brackets

No .sharp file in this repository writes uses on a function type: the Mago branch's mago compile accepts all 98 fixture files (Zend/tests/sharp/mago.toml) and all 22 standard library files (sharp/composer/mago.toml) on origin/master.

Problem:
Spec section 29 wrote a function type's effects after its closing `>`, as
in `Function<Charge(Cart)> uses Http charge`. That placement reads two ways
inside a type argument list, where a comma after an effect can start the
next type argument, and next to `?`. Jordan ruled option 2: `uses` goes
inside the brackets, after the parameter list.

Solution:
Section 29's example reads `Function<Charge(Cart) uses Http> charge`, and
the section gains Jordan's four approved lines with their annotations.
Section 14.1 names the placement. Decision 6's rejected example moves its
`uses` inside the brackets too. Decision 71 records the ruling, with
Swift's `throws` and Koka's effect rows as precedent and Java's `throws` as
the rejected one.

docs/
├── spec.md                                    section 14.1 names the placement; section 29's example moves and gains the four lines
└── decisions/
    ├── 006-function-argument-effects.md       the rejected `mapWithHttp` example writes `Function<TResult(T) uses Http> f`
    └── 071-function-type-effects.md           new: effects go inside the function type's brackets
@heyJordanParker
heyJordanParker merged commit f97d5ce into master Oct 11, 2026
7 checks passed
heyJordanParker added a commit that referenced this pull request Oct 11, 2026
Master's 070-template-values.md took number 70, and #87 claims 71. The
612-line 070-reified-generics.md carried each slice's working notes; the
record now holds the decision, the chosen option, each rejected option
with its reason, the precedent and the spec section, as records 49 to 69
do. Nothing linked the old file.
@heyJordanParker
heyJordanParker deleted the docs/function-type-uses branch November 3, 2026 22:08
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.

1 participant