Skip to content

prototype #1632.7: say why A & B is not Data - #1737

Closed
adeerkhan wants to merge 2 commits into
bendlang:mainfrom
adeerkhan:proto/1632-7-pair-data
Closed

adeerkhan wants to merge 2 commits into
bendlang:mainfrom
adeerkhan:proto/1632-7-pair-data

Conversation

@adeerkhan

@adeerkhan adeerkhan commented Oct 19, 2026 •

Copy link
Copy Markdown
Contributor

This is a prototype for proposal 7 of #1632 (a pair where Data is expected), in reply to the request to prototype 1–7. It is opened against bendlang/bend for review: bend2/bend.ts is human-written per AGENTS.md, so it is not a merge request as it stands. The branch is proto/1632-7-pair-data on the fork, a51b45c2, rebased on main; the repo gate is green.
At the kind comparison that throws expected Data: when the observed type is Type and the term's weak head normal form is a Sigma at &1, add the Note.

Your repro:

SOME PROOFS FAIL
Error:
- expected : Data
- observed : Type
Location: f
2 | 
3>| def f(xs: List<&2, U32 & U32>) -> List<&2, U32 & U32>:
  |                    ^^^^^^^^^
4 |   xs
Note: A & B is Sigma<&1, &1, ..>, which is Type. Write +Sigma<A, _ => B> (or Sigma<&2, &2, A, _ => B>) for a pair that is Data.

(a) removes the dead end, so I left (b) — accepting +(A & B) in the parser — alone, since it changes the language. Say the word and I'll put it on a branch too. No existing test output changes; tests/check/pair_sugar_not_data.bend pins this one.

@nicolas-abril

Copy link
Copy Markdown
Collaborator

Thanks for the prototype. Closing in favor of #2007, which does this in a smaller form to save tokens in bend.ts.

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