Skip to content

Initial version of typed holes support under allow-typed-holes flag#2486

Merged
facundominguez merged 14 commits intoucsd-progsys:developfrom
matheussbernardo:develop
Mar 24, 2026
Merged

Initial version of typed holes support under allow-typed-holes flag#2486
facundominguez merged 14 commits intoucsd-progsys:developfrom
matheussbernardo:develop

Conversation

@matheussbernardo
Copy link
Copy Markdown
Contributor

Based on PR#1140

I am adding a flag --allow-typed-holes
and detecting holes which are bindings with hole as infix.

These holes are currently being saved in the CGInfo and a warning is being presented to the user showing the refinement type.

I added one example in the test that shows how to use this experimental feature.

Copy link
Copy Markdown
Collaborator

@facundominguez facundominguez left a comment

Choose a reason for hiding this comment

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

Thanks @matheussbernardo. I left some comments. Can we have the feature documented? Maybe it could have a section in docs/mkDocs/docs/options.md.

Also, it would be helpful to have an example of a warning message produced by this implementation for the discussion.

Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/Constraint/Generate.hs Outdated
Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/Constraint/Generate.hs Outdated
Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/Constraint/Generate.hs Outdated
getSrcSpanFromTick = case genTick of
SourceNote src _ -> src
_ -> panic Nothing "Not a Source Note"
isVarHole = L.isInfixOf "hole" . F.symbolString . F.symbol
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.

Will this mistakenly catch variables written by the user that include "hole" in their name? e.g. whole, wholesale, etc.

To make this as precise as possible, I need to understand yet how the variable is bound.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I updated the implementation. Can you take a second look?

Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/Constraint/Types.hs Outdated
Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/Liquid.hs
Comment thread liquidhaskell-boot/src/Language/Haskell/Liquid/UX/CmdLine.hs Outdated
Comment thread docs/mkDocs/docs/options.md
Comment thread docs/mkDocs/docs/options.md
{-@ LIQUID "--expect-error-containing=Hole Found" @-}
{-@ LIQUID "--exact-data-cons" @-}
{-@ LIQUID "--allow-typed-holes" @-}
{-@ LIQUID "--warn-on-term-holes" @-}
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.

This could be added to the basic-pos testsuite. For scripts/test/test_plugin.sh to pick up the module, it will need to be listed in tests/tests.cabal.

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 just found that it is actually listed in tests.cabal. A separate executable seems overkill for a single test. It would be terser to put it in an existing executable.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I added more tests to this. I was thinking of adding all my examples to it. But maybe it is a overkill

@facundominguez
Copy link
Copy Markdown
Collaborator

👋 I rebased master to evaluate this PR again.

@facundominguez
Copy link
Copy Markdown
Collaborator

facundominguez commented Mar 24, 2026

We don't have any tooling depending on this yet, but I'm merging it because the implementation is small and unlikely to be problematic. I'll link the master's thesis afterwards.

Enhancing Proof Development in LiquidHaskell: Implementation and Evaluation of Typed Holes
MATHEUS DE SOUSA BERNARDO
Chalmers University of Technology, 2025

https://odr.chalmers.se/server/api/core/bitstreams/640ee29b-b13a-44d5-9e20-200a91a11021/content

@facundominguez facundominguez merged commit 7fffc99 into ucsd-progsys:develop Mar 24, 2026
6 checks passed
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.

2 participants