agda-stdlib icon indicating copy to clipboard operation
agda-stdlib copied to clipboard

Set the fixity of mixfix definitions

Open MatthewDaggitt opened this issue 8 years ago • 23 comments

Set the fixity of <? in Data.Nat.Properties.

MatthewDaggitt avatar Jan 12 '18 12:01 MatthewDaggitt

Closed with 5f4c67eca643120a275bea894716c76cc9f2defc

MatthewDaggitt avatar Jan 17 '18 10:01 MatthewDaggitt

Using the new -Wall option which I have just introduced, I have found a lot more mixfix definitions which do not come with a fixity declaration:

https://gist.github.com/gallais/79386a6ba8826620dc82b3f5d5af2bde

gallais avatar Jan 18 '18 19:01 gallais

Well, bracketing constructs like [_] or [_,_] do not need a fixity, in fact, since they are neither pre/post nor infix operators, a precedence or associativity value for these does not make sense. The warning mechanism should be adapted to disregard these.

andreasabel avatar Jan 19 '18 08:01 andreasabel

I've updated the gist with the new set of warnings ignoring well-bracketed mixfix decls

gallais avatar Jan 19 '18 11:01 gallais

As of Agda 2.6.0 the warnings for the missing fixities should now work properly, so this should be much more doable.

MatthewDaggitt avatar Jun 06 '19 05:06 MatthewDaggitt

Particularly egregious example in Relation.Binary.Construct.NonStrictToStrict

MatthewDaggitt avatar Jul 01 '19 12:07 MatthewDaggitt

@gallais can you update the gist please? I think I'm going to spend some of my time working on this.

JacquesCarette avatar Jun 02 '20 13:06 JacquesCarette

@JacquesCarette It's just a matter of running agda on Everything with -Wall.

gallais avatar Jun 02 '20 13:06 gallais

Hi, (I don't know if I am doing it right) I ran -

agda -Wall Everything.agda

locally, but could not reproduce the list of warnings, instead I got an error saying -

/Users/saransh/Code/Mitacs/agda-stdlib/Everything.agda:11,8-18
The name of the top level module does not match the file name. The
module Everything should be defined in one of the following files:
  /Users/saransh/Code/Mitacs/agda-stdlib/src/Everything.agda
  /Users/saransh/Code/Mitacs/agda-stdlib/src/Everything.lagda
  /opt/homebrew/Cellar/agda/2.6.3/libexec/ghc-9.4.4/Agd-2.6.3-d4728884/share/lib/prim/Everything.agda
  /opt/homebrew/Cellar/agda/2.6.3/libexec/ghc-9.4.4/Agd-2.6.3-d4728884/share/lib/prim/Everything.lagda

Should I be running agda on something else or with some additional flags? Thanks!

Saransh-cpp avatar Jun 13 '23 21:06 Saransh-cpp

You're probably missing -i .

gallais avatar Jun 13 '23 21:06 gallais

Ah, thanks! Works!

Saransh-cpp avatar Jun 14 '23 13:06 Saransh-cpp

An updated list for reference (will create a PR shortly) - https://gist.github.com/Saransh-cpp/99476398a0bf6fa78f1fc6a26edbb9fc

Saransh-cpp avatar Jun 14 '23 17:06 Saransh-cpp

I hope that @Saransh-cpp was using README/Design/Fixity.agda to set the fixities (I thought a reference to that file was here in the comments, but not so, only inside the linked PR).

JacquesCarette avatar Jun 15 '23 01:06 JacquesCarette

Ah I'd forgotten that even existed! Maybe that belongs in the style guide rather than an Agda file?

Anyway @Saransh-cpp, just to check does your PR follow these suggestions? :smile:

MatthewDaggitt avatar Jun 15 '23 01:06 MatthewDaggitt

If you're happy to "bless" this fixity guide then yes, probably should be integrated into the style guide.

JacquesCarette avatar Jun 15 '23 01:06 JacquesCarette

Oops, just saw the comments. I was indeed following the design guide!

Saransh-cpp avatar Jun 15 '23 01:06 Saransh-cpp

I've added the missing fixity for most of the declarations, but I could not really figure out the fixity for some of them. This gist has an updated list of missing fixities that I could not add (there might be repetitions). I'd be happy to add them in if someone could help me with the values. Thanks!

Edit: Updated list of missing fixities - https://github.com/Saransh-cpp/IdrisButNotAgda/tree/fixities

Saransh-cpp avatar Jun 15 '23 17:06 Saransh-cpp

I will attempt to look at the gist seriously as soon as I can. Still buried with many other things on my plate.

JacquesCarette avatar Jun 19 '23 19:06 JacquesCarette

Can the (updated) list be sorted, please?

jamesmckinna avatar Jan 13 '24 16:01 jamesmckinna

Should be sorted now!

Saransh-cpp avatar Jan 13 '24 23:01 Saransh-cpp

@JacquesCarette does/did #2386 also update README.Design.Fixity to reflect the recent additions/adjustments? (It's on me in my review for not having chased this up until now...)

jamesmckinna avatar May 16 '24 12:05 jamesmckinna

The remaining 50-odd definitions without a fixity (mostly under Function and Relation...) seem much less readily to admit a classification/categorisation with 'obvious' precedences... anyone care to have a go, or should we pick a default (20, say) and go with that?

jamesmckinna avatar Jun 05 '24 07:06 jamesmckinna

Yes, #2386 did update the documentation. I was going to continue slowing picking at this issue until it's done. Yes, it is getting trickier!

JacquesCarette avatar Jun 07 '24 02:06 JacquesCarette