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

Apply `--safe` and `--without-k` on a library level

Open MatthewDaggitt opened this issue 3 years ago • 5 comments

Now that Agda 2.6.2 has been released, we don't need the OPTIONS pragmas everywhere, we can instead specify the default options in the standard-library.agda file. This should zap several hundred lines of code in the process :tada: (not to mention avoid many wasted hours of tests failing when I forget to add them to new modules)

MatthewDaggitt avatar Jun 20 '21 09:06 MatthewDaggitt

Surely local flags cannot invalidate the ones set globally?

gallais avatar Jun 20 '21 10:06 gallais

Yes they can, see https://github.com/agda/agda/issues/5265#issuecomment-792256883

jespercockx avatar Jun 20 '21 10:06 jespercockx

So this means that we cannot trust a --safe in the lib file. This is distressing.

gallais avatar Jun 20 '21 10:06 gallais

I think --safe currently has a special status that means it is treated differently from other flags. In particular there is no way to disable --safe explicitly so it's not possible to turn it off once it has been turned on explicitly (be it in the file, on the command line, or in the agda-lib file). However, for other flags such as --without-K this is currently not the case, which is what that issue is about.

jespercockx avatar Jun 20 '21 10:06 jespercockx

Hmm, so sounds like we need two different fields in the library file default-flags which can be overridden and absolute-flags which can't? I'll open an Agda issue to discuss.

MatthewDaggitt avatar Jun 20 '21 10:06 MatthewDaggitt