Skip to content

Let Wingman's apply tactic run endomorphisms #1505

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

Merged
merged 3 commits into from
Mar 7, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 1 addition & 4 deletions plugins/hls-tactics-plugin/src/Ide/Plugin/Tactic/Tactics.hs
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,7 @@ apply hi = requireConcreteHole $ tracing ("apply' " <> show (hi_name hi)) $ do
func = hi_name hi
ty' <- freshTyvars ty
let (_, _, args, ret) = tacticsSplitFunTy ty'
-- TODO(sandy): Bug here! Prevents us from doing mono-map like things
-- Don't require new holes for locally bound vars; only respect linearity
-- see https://github.com/haskell/haskell-language-server/issues/1447
requireNewHoles $ rule $ \jdg -> do
rule $ \jdg -> do
unify g (CType ret)
ext
<- fmap unzipTrace
Expand Down
1 change: 1 addition & 0 deletions plugins/hls-tactics-plugin/test/CodeAction/AutoSpec.hs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ spec = do
autoTest 2 14 "FmapJoin.hs"
autoTest 2 9 "Fgmap.hs"
autoTest 4 19 "FmapJoinInLet.hs"
autoTest 9 12 "AutoEndo.hs"

failing "flaky in CI" $
autoTest 2 11 "GoldenApplicativeThen.hs"
Expand Down
10 changes: 10 additions & 0 deletions plugins/hls-tactics-plugin/test/golden/AutoEndo.hs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
data Synthesized b a = Synthesized
{ syn_trace :: b
, syn_val :: a
}
deriving (Eq, Show)


mapTrace :: (b -> b) -> Synthesized b a -> Synthesized b a
mapTrace = _

11 changes: 11 additions & 0 deletions plugins/hls-tactics-plugin/test/golden/AutoEndo.hs.expected
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
data Synthesized b a = Synthesized
{ syn_trace :: b
, syn_val :: a
}
deriving (Eq, Show)


mapTrace :: (b -> b) -> Synthesized b a -> Synthesized b a
mapTrace fbb (Synthesized b a)
= Synthesized {syn_trace = fbb b, syn_val = a}