Skip to content

Make final parameter of Acc an index#3020

Draft
Taneb wants to merge 2 commits into
masterfrom
acc-index
Draft

Make final parameter of Acc an index#3020
Taneb wants to merge 2 commits into
masterfrom
acc-index

Conversation

@Taneb

@Taneb Taneb commented Jun 18, 2026

Copy link
Copy Markdown
Member

Suggested by @TOTBWF during my investigation on Mikan compatibility. This makes induction proofs pass Mikan's termination checker, and doesn't seem to break anything with Agda.

@gallais

gallais commented Jun 18, 2026

Copy link
Copy Markdown
Member

Does that impact the generated code? It looks to me like acc would now be storing its index
and may not be erasable anymore?

@Taneb

Taneb commented Jun 18, 2026

Copy link
Copy Markdown
Member Author

You're right, it doesn't look like MAlonzo is able to erase Acc any more :(

@gallais gallais marked this pull request as draft June 18, 2026 10:15
@JacquesCarette

Copy link
Copy Markdown
Collaborator

But maybe this is still the 'right' Acc?

@gallais

gallais commented Jun 22, 2026

Copy link
Copy Markdown
Member

Would marking x as erased bring back the compilation to performant Acc-free code?

@TOTBWF

TOTBWF commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Mikan has dropped support for erasure, so that would somewhat defeat the purpose.

That being said, I agree with @JacquesCarette: this non-regular parameter is a bit dubious. Unfortunately, it seems like Barras' thesis has bit-rotted off the internet, but I don't see a way to use his encoding to construct an index that forcing analysis would be able to erase. (I actually don't even know if his encoding works for higher-order datatypes like Acc, but that's a separate can of worms!)

@Taneb

Taneb commented Jun 23, 2026

Copy link
Copy Markdown
Member Author

I did a not really scientific benchmark of actually running a program that heavily uses Acc that I had lying around, and I don't see any significant changes in runtime between index and parameter. So maybe even though MAlonzo can't get rid of it, GHC can?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants