Skip to content

Commit

Permalink
Let apply run endomorphisms (#1505)
Browse files Browse the repository at this point in the history
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
isovector and mergify[bot] committed Mar 7, 2021
1 parent 1b245ca commit d517659
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 4 deletions.
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}

0 comments on commit d517659

Please sign in to comment.