Skip to content

Commit d517659

Browse files
Let apply run endomorphisms (#1505)
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
1 parent 1b245ca commit d517659

File tree

4 files changed

+23
-4
lines changed

4 files changed

+23
-4
lines changed

plugins/hls-tactics-plugin/src/Ide/Plugin/Tactic/Tactics.hs

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -167,10 +167,7 @@ apply hi = requireConcreteHole $ tracing ("apply' " <> show (hi_name hi)) $ do
167167
func = hi_name hi
168168
ty' <- freshTyvars ty
169169
let (_, _, args, ret) = tacticsSplitFunTy ty'
170-
-- TODO(sandy): Bug here! Prevents us from doing mono-map like things
171-
-- Don't require new holes for locally bound vars; only respect linearity
172-
-- see https://github.com/haskell/haskell-language-server/issues/1447
173-
requireNewHoles $ rule $ \jdg -> do
170+
rule $ \jdg -> do
174171
unify g (CType ret)
175172
ext
176173
<- fmap unzipTrace

plugins/hls-tactics-plugin/test/CodeAction/AutoSpec.hs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ spec = do
4545
autoTest 2 14 "FmapJoin.hs"
4646
autoTest 2 9 "Fgmap.hs"
4747
autoTest 4 19 "FmapJoinInLet.hs"
48+
autoTest 9 12 "AutoEndo.hs"
4849

4950
failing "flaky in CI" $
5051
autoTest 2 11 "GoldenApplicativeThen.hs"
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
data Synthesized b a = Synthesized
2+
{ syn_trace :: b
3+
, syn_val :: a
4+
}
5+
deriving (Eq, Show)
6+
7+
8+
mapTrace :: (b -> b) -> Synthesized b a -> Synthesized b a
9+
mapTrace = _
10+
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
data Synthesized b a = Synthesized
2+
{ syn_trace :: b
3+
, syn_val :: a
4+
}
5+
deriving (Eq, Show)
6+
7+
8+
mapTrace :: (b -> b) -> Synthesized b a -> Synthesized b a
9+
mapTrace fbb (Synthesized b a)
10+
= Synthesized {syn_trace = fbb b, syn_val = a}
11+

0 commit comments

Comments
 (0)