File tree 4 files changed +21
-12
lines changed
plugins/hls-tactics-plugin
4 files changed +21
-12
lines changed Original file line number Diff line number Diff line change @@ -5,7 +5,7 @@ module Ide.Plugin.Tactic.KnownStrategies where
5
5
import Control.Monad.Error.Class
6
6
import Ide.Plugin.Tactic.Context (getCurrentDefinitions )
7
7
import Ide.Plugin.Tactic.KnownStrategies.QuickCheck (deriveArbitrary )
8
- import Ide.Plugin.Tactic.Machinery (tracing )
8
+ import Ide.Plugin.Tactic.Machinery (tracing , try' )
9
9
import Ide.Plugin.Tactic.Tactics
10
10
import Ide.Plugin.Tactic.Types
11
11
import OccName (mkVarOcc )
@@ -29,7 +29,7 @@ known name t = do
29
29
30
30
deriveFmap :: TacticsM ()
31
31
deriveFmap = do
32
- try intros
32
+ try' intros
33
33
overAlgebraicTerms homo
34
34
choice
35
35
[ overFunctions apply >> auto' 2
Original file line number Diff line number Diff line change @@ -272,3 +272,16 @@ requireConcreteHole m = do
272
272
0 -> m
273
273
_ -> throwError TooPolymorphic
274
274
275
+
276
+ ------------------------------------------------------------------------------
277
+ -- | The 'try' that comes in refinery 0.3 causes unnecessary backtracking and
278
+ -- balloons the search space. This thing just tries it, but doesn't backtrack
279
+ -- if it fails.
280
+ --
281
+ -- TODO(sandy): Remove this when we upgrade to 0.4
282
+ try'
283
+ :: Functor m
284
+ => TacticT jdg ext err s m ()
285
+ -> TacticT jdg ext err s m ()
286
+ try' t = commit t $ pure ()
287
+
Original file line number Diff line number Diff line change @@ -309,21 +309,17 @@ localTactic t f = do
309
309
310
310
311
311
refine :: TacticsM ()
312
- refine = go 3
313
- where
314
- go 0 = pure ()
315
- go n = do
316
- let try_that_doesnt_suck t = commit t $ pure ()
317
- try_that_doesnt_suck intros
318
- try_that_doesnt_suck splitSingle
319
- go $ n - 1
312
+ refine = do
313
+ try' intros
314
+ try' splitSingle
315
+ try' intros
320
316
321
317
322
318
auto' :: Int -> TacticsM ()
323
319
auto' 0 = throwError NoProgress
324
320
auto' n = do
325
321
let loop = auto' (n - 1 )
326
- try intros
322
+ try' intros
327
323
choice
328
324
[ overFunctions $ \ fname -> do
329
325
apply fname
Original file line number Diff line number Diff line change 1
1
test :: ((), (b, c), d)
2
- test = ((), ( _, _) , _)
2
+ test = (_, _, _)
3
3
You can’t perform that action at this time.
0 commit comments