Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Positivity checking runs on reexports? #2382

Open
gergoerdi opened this issue Oct 11, 2024 · 2 comments
Open

Positivity checking runs on reexports? #2382

gergoerdi opened this issue Oct 11, 2024 · 2 comments

Comments

@gergoerdi
Copy link
Contributor

gergoerdi commented Oct 11, 2024

With the classic non-positive type definition:

{-@ LIQUID "--no-positivity-check" @-}
module Debug.Liquid.PositivityChecker.Mod where

data Neg = MkNeg (Neg -> ())

I was surprised that the following module then ALSO fails the positivity checker:

module Debug.Liquid.PositivityChecker.Use (module M) where

import Debug.Liquid.PositivityChecker.Mod as M

This fails with (note the missing source location):

Source error while processing module Debug.Liquid.PositivityChecker.Use:
  <no location info>: error:
      Negative occurence of Debug.Liquid.PositivityChecker.Mod.Neg in Debug.Liquid.PositivityChecker.Mod.MkNeg : (Debug.Liquid.PositivityChecker.Mod.Neg -> ())
%1 -> Debug.Liquid.PositivityChecker.Mod.Neg


To deactivate or understand the need of positivity check, see:
  https://ucsd-progsys.github.io/liquidhaskell/options/#positivity-check

Is this intentional?

(As a side note, I love "to deactivate or understand" in a warning message 😆)

@nikivazou
Copy link
Member

To me, it makes sense that you need the non-positivity check also in the modules that import and use the non-positive data.
But I am not opposed to, by default, deactivate it, if you think it is unreasonable.

@gergoerdi
Copy link
Contributor Author

To me, it makes sense that you need the non-positivity check also in the modules that import and use the non-positive data. But I am not opposed to, by default, deactivate it, if you think it is unreasonable.

Hmm OK, so it is intentional. But then this leads to the question of is it possible to turn off positivity checking for a single datatype definition? Otherwise, the flag becomes very "infectious" on other modules.

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

No branches or pull requests

2 participants