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

Populate positional vars for non-RHS holes #20

Open
isovector opened this issue Oct 6, 2020 · 1 comment
Open

Populate positional vars for non-RHS holes #20

isovector opened this issue Oct 6, 2020 · 1 comment
Labels
bug Something isn't working lsp

Comments

@isovector
Copy link
Owner

isovector commented Oct 6, 2020

That is, if i write

case foo of
  Bar a b c -> _

the hole should get (foo.[[a,b,c]]) inserted in its position vars judgement

@isovector isovector added bug Something isn't working lsp labels Oct 6, 2020
@isovector
Copy link
Owner Author

getRhsPosVals :: RealSrcSpan -> TypecheckedSource -> Maybe (OccName, [OccName])
getRhsPosVals rss tcs = getFirst $ everything (<>) (mkQ mempty $ \case
TopLevelRHS name ps
(L (RealSrcSpan span) -- body with no guards and a single defn
(HsVar _ (L _ hole)))
| containsSpan rss span -- which contains our span
, isHole $ occName hole -- and the span is a hole
-> First $ do
patnames <- traverse getPatName ps
pure (occName name, patnames)
_ -> mempty
) tcs
implements this for function RHSes. The more general solution is likely to just extend this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working lsp
Projects
None yet
Development

No branches or pull requests

1 participant