Skip to content

Commit 8d4901b

Browse files
committed
use 'algebraicTyCon' as filter for now
1 parent 8772f62 commit 8d4901b

File tree

2 files changed

+7
-15
lines changed

2 files changed

+7
-15
lines changed

plugins/tactics/src/Ide/Plugin/Tactic.hs

Lines changed: 4 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import Control.Monad.Trans.Maybe
2121
import Data.Aeson
2222
import Data.Coerce
2323
import qualified Data.Foldable as F
24-
import qualified Data.List as L
2524
import qualified Data.Map as M
2625
import Data.Maybe
2726
import qualified Data.Set as S
@@ -38,7 +37,7 @@ import Development.Shake (Action)
3837
import DynFlags (xopt)
3938
import qualified FastString
4039
import GHC.Generics (Generic)
41-
import GHC.LanguageExtensions.Type (Extension (LambdaCase, MagicHash))
40+
import GHC.LanguageExtensions.Type (Extension (LambdaCase))
4241
import Ide.Plugin (mkLspCommand)
4342
import Ide.Plugin.Tactic.Context
4443
import Ide.Plugin.Tactic.GHC
@@ -95,10 +94,9 @@ commandProvider Intros =
9594
filterGoalType isFunction $
9695
provide Intros ""
9796
commandProvider Split =
98-
foldMapGoalType (F.fold . tyDataCons) $ \dc ->
99-
let cname = occNameString $ getOccName dc
100-
in requireExtensionWhen MagicHash ("#" `L.isSuffixOf` cname) $
101-
provide Split $ T.pack cname
97+
filterGoalType (isJust . algebraicTyCon) $
98+
foldMapGoalType (F.fold . tyDataCons) $ \dc ->
99+
provide Split $ T.pack $ occNameString $ getOccName dc
102100
commandProvider Destruct =
103101
filterBindingType destructFilter $ \occ _ ->
104102
provide Destruct $ T.pack $ occNameString occ
@@ -193,13 +191,6 @@ requireExtension ext tp dflags plId uri range jdg =
193191
False -> pure []
194192

195193

196-
------------------------------------------------------------------------------
197-
-- | Like 'requireExtension' but only check if the bool is @True@.
198-
requireExtensionWhen :: Extension -> Bool -> TacticProvider -> TacticProvider
199-
requireExtensionWhen ext True = requireExtension ext
200-
requireExtensionWhen _ False = id
201-
202-
203194
------------------------------------------------------------------------------
204195
-- | Create a 'TacticProvider' for each occurance of an 'a' in the foldable container
205196
-- extracted from the goal type. Useful instantiations for 't' include 'Maybe' or '[]'.

test/functional/Tactic.hs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ import Language.Haskell.LSP.Types (ApplyWorkspaceEditRequest, Position
2121
import Test.Hls.Util
2222
import Test.Tasty
2323
import Test.Tasty.HUnit
24+
import Test.Tasty.ExpectedFailure (ignoreTestBecause)
2425
import System.FilePath
2526
import System.Directory (doesFileExist)
2627
import Control.Monad (unless)
@@ -80,8 +81,8 @@ tests = testGroup
8081
"T3.hs" 7 13
8182
[ (id, DestructLambdaCase, "")
8283
]
83-
, mkTest
84-
"Produces I# with -XMagicHash"
84+
, ignoreTestBecause "Not implemented, see #31" $ mkTest
85+
"Splits Int with I# when -XMagicHash is enabled"
8586
"T3.hs" 10 14
8687
[ (id, Split, "I#")
8788
]

0 commit comments

Comments
 (0)