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

Wingman Intelligent derivations of Semigroup and Monoid doesn't work as expected. #1680

Closed
fonghou opened this issue Apr 6, 2021 · 2 comments
Labels
component: wingman type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@fonghou
Copy link

fonghou commented Apr 6, 2021

Your environment

Output of haskell-language-server --probe-tools or haskell-language-server-wrapper --probe-tools:

It's built from master source with @isovector PR #1675 merged locally.

❯ haskell-language-server-wrapper --probe-tools
haskell-language-server version: 1.0.0.0 (GHC: 8.10.4) (PATH: /home/haskeller/.local/bin/haskell-language-server-wrapper) (GIT hash: c67b233bd21bc749e011ce9c5f7038466b69be7e)
Tool versions found on the $PATH
cabal:          3.4.0.0
stack:          2.5.1
ghc:            Not found

Which OS do you use:

Which lsp-client do you use: coc-nvim on Ubuntu

Describe your project (alternative: link to the project):

Contents of hie.yaml:

❯ cat hie.yaml
cradle:
  stack:

Steps to reproduce

image

Expected behaviour

According to plugins/hls-tactics-plugin/test/golden/KnownDestructedSemigroup.hs.expected

data Test a = Test [a]

instance Semigroup (Test a) where
   (<>) (Test a) (Test c) = Test (a <> c)

Ideally,

data Test a = Test [a]

instance Semigroup (Test a) where
   Test a <> Test c = Test (a <> c)

Actual behaviour

image

Include debug information

Execute in the root of your project the command haskell-language-server --debug . and paste the logs here:

Debug output:
<paste your logs here>

Paste the logs from the lsp-client, e.g. for VS Code

LSP logs:
<paste your logs here>
!!!goal: Judgement {_jHypothesis = Hypothesis {unHypothesis = [HyInfo {hi_name = a, hi_provenance = PatternMatchPrv (PatVal {pv_scrutinee = Just _0, pv_ancestry = fromList [<>,_0], pv_datacon = Test, pv_position = 0}), hi_type = [a]},HyInfo {hi_name = _0, hi_provenance = DisallowedPrv AlreadyDestructed (TopLevelArgPrv <> 0 2), hi_type = Test a},HyInfo {hi_name = c, hi_provenance = PatternMatchPrv (PatVal {pv_scrutinee = Just _1, pv_ancestry = fromList [<>,_1], pv_datacon = Test, pv_position = 0}), hi_type = [a]},HyInfo {hi_name = _1, hi_provenance = DisallowedPrv AlreadyDestructed (TopLevelArgPrv <> 1 2), hi_type = Test a},HyInfo {hi_name = <>, hi_provenance = ClassMethodPrv Semigroup, hi_type = a -> a -> a},HyInfo {hi_name = sconcat, hi_provenance = ClassMethodPrv Semigroup, hi_type = NonEmpty a -> a},HyInfo {hi_name = stimes, hi_provenance = ClassMethodPrv Semigroup, hi_type = forall b. Integral b => b -> a -> a}]}, _jBlacklistDestruct = False, _jWhitelistSplit = True, _jIsTopHole = True, _jGoal = Test a}
!!!ctx: [(<>,Test a -> Test a -> Test a)]
!!!skolems: fromList [a]
!!!other solution: case a of
  [] -> Test []
  (a7 : l_a) -> Test []
!!!with score: (Down 0,False,Down 0,Down 2,1,Down 0,Down 87)
!!!other solution: case a of
  [] -> Test []
  (a7 : l_a) -> Test (a7 : [])
!!!with score: (Down 0,False,Down 0,Down 2,2,Down 0,Down 161)
!!!other solution: case a of
  [] -> Test []
  (a7 : l_a) -> Test c
!!!with score: (Down 0,False,Down 0,Down 2,2,Down 0,Down 87)
!!!other solution: case a of
  [] -> Test c
  (a7 : l_a) -> Test c
!!!with score: (Down 0,False,Down 0,Down 2,2,Down 0,Down 87)
!!!other solution: case a of
  [] -> Test c
  (a7 : l_a) -> Test []
!!!with score: (Down 0,False,Down 0,Down 2,2,Down 0,Down 87)
!!!other solution: case a of
  [] -> Test []
  (a7 : l_a) -> Test (a7 : c)
!!!with score: (Down 0,False,Down 0,Down 2,3,Down 0,Down 161)
!!!other solution: case a of
  [] -> Test c
  (a7 : l_a) -> Test (a7 : c)
!!!with score: (Down 0,False,Down 0,Down 2,3,Down 0,Down 161)
!!!other solution: case a of
  [] -> Test c
  (a7 : l_a) -> Test (a7 : [])
!!!with score: (Down 0,False,Down 0,Down 2,3,Down 0,Down 161)
!!!other solution: Test []
!!!with score: (Down 0,True,Down 0,Down 0,0,Down 0,Down 7)
!!!other solution: Test c
!!!with score: (Down 0,True,Down 0,Down 0,1,Down 0,Down 7)
!!!other solution: Test a
!!!with score: (Down 0,True,Down 0,Down 0,1,Down 0,Down 7)
!!!solution: Test a

@Ailrun Ailrun added component: wingman type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. status: needs repro labels Apr 7, 2021
@July541
Copy link
Collaborator

July541 commented Apr 7, 2021

@Ailrun I dump the test response of tactics, it generates the correct result, but not successfully apply this action to the client(fails as this issue described). I can't locate the issue where it occurs.

Here is the code action's response of KnownDestructedSemigroup.hs:
image
We can see clearly it generate the correct result.

Does there exist any trick to trace the calling stack? I'd love to fix it.

@isovector
Copy link
Collaborator

This is by design --- for now. Some new features are intentionally guarded from the public release as incentives for my patreon. Signing up for the "Beta" tier gets you access to these things as soon as they're merged.

This is not forever, cool new features will be enabled globally with a one-release latency.

It sorta sucks, but I'm working on Wingman full time, and need to find some way to make ends meet. Corporate sponsorship would be the dream here, where I can build features without worrying about monetization, but unfortunately that's not currently in the cards.

If you want to forge forwards here, the feature protection is intentionally very easy to work around. You have my blessing to go reverse engineer it --- but please don't talk about it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: wingman type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

4 participants