Skip to content

Allow local logical aliases (defines)#2463

Merged
facundominguez merged 18 commits into
ucsd-progsys:developfrom
clayrat:local-define-logic
Jan 9, 2025
Merged

Allow local logical aliases (defines)#2463
facundominguez merged 18 commits into
ucsd-progsys:developfrom
clayrat:local-define-logic

Conversation

@clayrat

@clayrat clayrat commented Dec 11, 2024

Copy link
Copy Markdown
Contributor

This PR adds the ability to define logic aliases with a new define annotation outside the built-in Language.Haskell.Liquid.GHC.CoreToLogic module. The declarations re-use the name resolution machinery, allowing for partial qualification. The local aliases are re-exported to the dependencies.

Following this, all useful defines have been moved out of the global CoreToLogic map, and the module itself has been removed:

  • GHC.Internal.Base.$
  • GHC.Classes.not
  • GHC.Types.True
  • GHC.CString.unpackCString#
  • Language.Haskell.Liquid.ProofCombinators.withProof
  • Set and Bag operations
  • Numeric primitive aliases for Real and a local Integer alias needed in tests/pos/NumRefl.hs

@clayrat

clayrat commented Dec 11, 2024

Copy link
Copy Markdown
Contributor Author

filtered
bot
top

@facundominguez facundominguez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice to see this feature in the works.

Import aliases are ignored when resolving defines. This made sense when they were global, but now that they are defined in modules, it would be best to treat them the same as measures or reflected functions.

There are other things to adjust that I mentioned in comments. But if name resolution looks too difficult, I could try contributing some of it, probably in January.

Another thing needed would be some user documentation for the new define annotation.

Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/Types/Specs.hs Outdated
Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/Types/Specs.hs Outdated
@clayrat clayrat changed the title Allow local logical aliases (defines) WIP Allow local logical aliases (defines) Dec 16, 2024
Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/Types/Types.hs Outdated
Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/Types/Types.hs Outdated
Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/Types/Names.hs Outdated

@facundominguez facundominguez left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wonder if there is any define that needs to stay in CoreToLogic rather than being moved to an existing module.

Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/CoreToLogic.hs Outdated
Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/CoreToLogic.hs Outdated
Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/CoreToLogic.hs Outdated
@clayrat clayrat changed the title WIP Allow local logical aliases (defines) Allow local logical aliases (defines) Dec 18, 2024
Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/CoreToLogic.hs Outdated
Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/CoreToLogic.hs Outdated
Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/CoreToLogic.hs Outdated
Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/CoreToLogic.hs Outdated
Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/CoreToLogic.hs Outdated
Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/CoreToLogic.hs Outdated
@facundominguez

Copy link
Copy Markdown
Collaborator

Thanks @clayrat!

@facundominguez facundominguez merged commit d13f9d3 into ucsd-progsys:develop Jan 9, 2025
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

Successfully merging this pull request may close these issues.

3 participants