-
Notifications
You must be signed in to change notification settings - Fork 138
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
Allow local logical aliases (defines) #2463
base: develop
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
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.
There was a problem hiding this comment.
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.
liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/CoreToLogic.hs
Outdated
Show resolved
Hide resolved
liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/CoreToLogic.hs
Outdated
Show resolved
Hide resolved
liquidhaskell-boot/src/Language/Haskell/Liquid/GHC/CoreToLogic.hs
Outdated
Show resolved
Hide resolved
, "define Language.Haskell.Liquid.Bag.empty = (Bag_empty 0)" | ||
, "" | ||
[ "define GHC.Types.True = (true)" | ||
, "define GHC.Classes.not x = (~ x)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this can go in src/GHC/Classes_LHAssumptions.hs
.
, "define Language.Haskell.Liquid.Equational.eq x y = (y)" | ||
, "" | ||
, "define GHC.CString.unpackCString# x = x" | ||
, "define Language.Haskell.Liquid.ProofCombinators.cast x y = (y)" | ||
, "define Liquid.ProofCombinators.cast x y = (y)" | ||
, "define ProofCombinators.cast x y = (y)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And perhaps these can be migrated to liquid-prelude
.
, "define Language.Haskell.Liquid.ProofCombinators.cast x y = (y)" | ||
, "define Language.Haskell.Liquid.ProofCombinators.withProof x y = (x)" | ||
, "define ProofCombinators.cast x y = (y)" | ||
, "define Liquid.ProofCombinators.cast x y = (y)" | ||
, "define Control.Parallel.Strategies.withStrategy s x = (x)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could it be migrated to liquid-parallel/src/Control/Parallel/Strategies_LHAssumptions.hs
?
, "" | ||
[ "define GHC.Types.True = (true)" | ||
, "define GHC.Classes.not x = (~ x)" | ||
, "define GHC.Internal.Base.$ f x = (f x)" | ||
, "define Main.mempty = (mempty)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does this one have any effect on tests?
, "define Language.Haskell.Liquid.Bag.sub a b = (Bag_sub a b)" | ||
, "define Language.Haskell.Liquid.Bag.empty = (Bag_empty 0)" | ||
, "" | ||
[ "define GHC.Types.True = (true)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To migrate to src/GHC/Types_LHAssumptions.hs
(?)
, "" | ||
[ "define GHC.Types.True = (true)" | ||
, "define GHC.Classes.not x = (~ x)" | ||
, "define GHC.Internal.Base.$ f x = (f x)" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe this can be migrated to src/GHC/Base_LHAssumptions.hs
.
This PR adds the ability to define logic aliases with a new
define
annotation outside of the built-inLanguage.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, some defines have been moved out of
CoreToLogic
:Set
andBag
operationsGHC.CString.unpackCString#
Language.Haskell.Liquid.ProofCombinators.withProof
Real
and a localInteger
alias needed intests/pos/NumRefl.hs