Idris2 icon indicating copy to clipboard operation
Idris2 copied to clipboard

[ new ] Support arbitrary `Name` in `IBindVar`

Open spcfox opened this issue 9 months ago • 16 comments

Description

Replaces String with Name in the IBindVar signature. This makes IBindVar more consistent and allows the binding of machine-generated names. Using machine-generated names in IBindVar can be useful in compiler and elaborator scripts.

Should this change go in the CHANGELOG?

  • [x] If this is a fix, user-facing change, a compiler change, or a new paper implementation, I have updated CHANGELOG_NEXT.md (and potentially also CONTRIBUTORS.md).

spcfox avatar Mar 26 '25 15:03 spcfox

This PR is ready to review. The fixes in LSP-lib, elab-util, frex and idrall (for katla) should be enough for a green CI

spcfox avatar Mar 26 '25 15:03 spcfox

The status of the pack collection with this branch:

[ warning ] The following packages failed to build:
            - barbies
            - bounded-doubles-hedgehog-generators(failing dependencies: pretty-show, sop)
            - chem-generators(failing dependencies: pretty-show, sop)
            - cyby-draw(failing dependencies: json-simple)
            - dependent-map(failing dependencies: pretty-show, sop)
            - deptycheck
            - dom-mvc(failing dependencies: json-simple)
            - dom-mvc-extra(failing dependencies: json-simple, barbies)
            - hedgehog(failing dependencies: pretty-show, sop)
            - http(failing dependencies: sop)
            - json
            - json-simple
            - lana(failing dependencies: json, json-simple)
            - node
            - parser-tsv
            - parser-webidl(failing dependencies: sop)
            - pretty-show
            - refined-json(failing dependencies: json-simple)
            - refined-tsv(failing dependencies: parser-tsv)
            - sop
            - sqlite3
            - sqlite3-rio(failing dependencies: sqlite3)
            - stellar-http(failing dependencies: node)
            - stellar-sql(failing dependencies: sqlite3, json)
            - tls(failing dependencies: sop)
            - tyttp-adapter-node(failing dependencies: node)
            - tyttp-json(failing dependencies: json, sop, node)
            - webidl(failing dependencies: sop)
[ warning ] 28 packages failed to build.

spcfox avatar Mar 26 '25 17:03 spcfox

Looking at the failing pack libraries, this will require quite a bit of work till the pack collection is up and running again. Many of the failing packages are my own, so they should be fine. deptycheck and node are not, so we probably should get in touch with their maintainers.

I for my part am ready to go with this and merge the adjustments made to elab-util as soon as reviewers are ready to merge this.

Thanks, spcfox, for going through the trouble and also checking the pack collection!

stefan-hoeck avatar Mar 27 '25 05:03 stefan-hoeck

I'm working with @buzden, we're ready to make changes to deptycheck

spcfox avatar Mar 27 '25 06:03 spcfox

As a comment beside libraries changes, I've talked about this change with Edwin in 2021 and he agreed that this should be done and said that he didn't remember why the current design of IBindVar was chosen.

buzden avatar Mar 27 '25 09:03 buzden

I believe we need to bump the TTC version in src/Core/Binary.idr. Otherwise, it will fail with "file: Corrupt TTC data for Name" when it reads .ttc files made by the current Idris.

dunhamsteve avatar Mar 27 '25 13:03 dunhamsteve

I'm not sure if this kind of code is supposed to work. It doesn't right now

definition : Decl
definition =
   IDef EmptyFC `{ foo }
        [ PatClause EmptyFC `( foo ~(IBindVar EmptyFC $ UN $ Basic "x") )
                             (IVar EmptyFC (DN "y" $ UN $ Basic "x"))]

spcfox avatar Mar 27 '25 17:03 spcfox

I'm not sure if this kind of code is supposed to work. It doesn't right now

definition : Decl
definition =
   IDef EmptyFC `{ foo }
        [ PatClause EmptyFC `( foo ~(IBindVar EmptyFC $ UN $ Basic "x") )
                             (IVar EmptyFC (DN "y" $ UN $ Basic "x"))]

I think it should, because I understand DN as a purely pretty-printing thing, which should not influence on typechecking

buzden avatar Apr 24 '25 12:04 buzden

I'm not sure if this kind of code is supposed to work. It doesn't right now

definition : Decl
definition =
   IDef EmptyFC `{ foo }
        [ PatClause EmptyFC `( foo ~(IBindVar EmptyFC $ UN $ Basic "x") )
                             (IVar EmptyFC (DN "y" $ UN $ Basic "x"))]

Ok, this is not related to the current PR, created an issue https://github.com/idris-lang/Idris2/issues/3542 on this behavior

spcfox avatar Apr 28 '25 16:04 spcfox

List of packages requiring fixes:

CI:

Pack collection:

@stefan-hoeck:

other:

Failed due to dependencies:

spcfox avatar May 22 '25 17:05 spcfox

I've prepared patches to all the libraries. This PR is ready for review and merge.

spcfox avatar May 24 '25 20:05 spcfox

I'm really for merging this PR. In order to make Idris CI to become green, we need besides e.g. me, one of @ohad or @gallais for frex, and one of @mattpolzin or @alexhumphreys for idrall, which is a dependency for katla. All that we need is to merge corresponding pull requests adapting to this one.

In order the next pack collection won't fail building next day, we need also @stefan-hoeck and @kbertalan to be ready to merge compat pull requests to their repos.

Guys, can we syncronise, say, today to do all that?

buzden avatar May 26 '25 06:05 buzden

I'm ready to update my packages as soon as this is merged. Today would be fine, tomorrow also.

stefan-hoeck avatar May 26 '25 08:05 stefan-hoeck

Works for me.

mattpolzin avatar May 26 '25 12:05 mattpolzin

I can merge the changes to my project when this is merged within a 12 hours window any week day this week.

kbertalan avatar May 26 '25 15:05 kbertalan

@ohad, @gallais, @stefan-hoeck, @mattpolzin, @kbertalan, @buzden How about this week?

spcfox avatar Jun 09 '25 16:06 spcfox

@spcfox how is it going? Will this be ever finished?

kbertalan avatar Jul 26 '25 17:07 kbertalan

@spcfox how is it going? Will this be ever finished?

The PR is ready to be merged, but it impacts multiple libraries, making synchronization difficult. Last time, we didn’t receive any response from maintainers with access to frex. I believe we’ll be able to complete this once @gallais and @buzden are back from vacation.

spcfox avatar Jul 27 '25 10:07 spcfox

I'm happy to go ahead with this.

gallais avatar Aug 13 '25 09:08 gallais

I'm happy to go ahead with this.

Let's synchronise, then. To make compiler's CI jobs green we need to merge appropriate PRs to elab-utils (I can do it), lsp-lib, frex and idrall (@mattpolzin can)

buzden avatar Aug 13 '25 13:08 buzden

I'm still available to merge the LSP and/or Idrall PRs on relatively short notice.

mattpolzin avatar Aug 13 '25 19:08 mattpolzin

@stefan-hoeck @kbertalan This PR has been approved, I think we'll merge it tomorrow.

spcfox avatar Aug 13 '25 21:08 spcfox

Then I'd suggest @gallais to merge appropriate upstream PR to frex as a signal to others to start merging PRs to elab-util, idrall and lsp-lib, and then we'll rerun this PR's CI jobs to check all's green.

buzden avatar Aug 14 '25 12:08 buzden

Merged on frex

gallais avatar Aug 14 '25 12:08 gallais

Merged idrall

mattpolzin avatar Aug 14 '25 13:08 mattpolzin

@stefan-hoeck @kbertalan We did it!

spcfox avatar Aug 14 '25 14:08 spcfox

I just started a test to generate a new pack nightly to see whether we missed something. Will report back here.

stefan-hoeck avatar Aug 14 '25 14:08 stefan-hoeck

Oh dear, this will take some time. Currently, the following libraries still fail:

[ warning ] The following packages failed to build:
- barbies
- bounded-doubles-hedgehog-generators(failing dependencies: pretty-show)
- chem-generators(failing dependencies: pretty-show)
- cyby-draw(failing dependencies: json-simple)
- dependent-map(failing dependencies: pretty-show)
- deptycheck
- dom-mvc(failing dependencies: json-simple)
- dom-mvc-extra(failing dependencies: json-simple, barbies)
- hedgehog(failing dependencies: pretty-show)
- json
- json-simple
- lana(failing dependencies: json, json-simple)
- node
- pact-api(failing dependencies: json)
- pact-client(failing dependencies: json)
- pact-server(failing dependencies: json)
- pact-todomvc(failing dependencies: json)
- pact-wai(failing dependencies: json)
- parser-tsv
- parser-webidl
- pretty-show
- refined-json(failing dependencies: json-simple)
- refined-tsv(failing dependencies: parser-tsv)
- sqlite3
- sqlite3-rio(failing dependencies: sqlite3)
- stellar-http(failing dependencies: node, json-simple)
- stellar-sql(failing dependencies: sqlite3, json)
- tyttp-adapter-node(failing dependencies: node)
- tyttp-json(failing dependencies: json, node)
- webidl(failing dependencies: parser-webidl)

The ones with failing dependencies might be fine once the dependencies have been fixed. I can take care of my own libs. @buzden, deptycheck is yours, right? @kbertalan, node is your lib. Could you please have a look at that one?

stefan-hoeck avatar Aug 14 '25 15:08 stefan-hoeck

@stefan-hoeck I expect that these PRs should be enough (each link leads to the corresponding PR). deptycheck is already merged https://github.com/idris-lang/Idris2/pull/3526#issuecomment-2901992369

spcfox avatar Aug 14 '25 16:08 spcfox

@stefan-hoeck I expect that these PRs should be enough (each link leads to the corresponding PR). deptycheck is already merged #3526 (comment)

Ah, sorry, forgot about that list. You have been very thorough. Am fixing the remaining libs now (with the exception of node).

stefan-hoeck avatar Aug 14 '25 16:08 stefan-hoeck