Skip to content

Commit 674f299

Browse files
committed
NoExt and less dependency on ghc
1 parent 2ab4d03 commit 674f299

File tree

4 files changed

+14
-8
lines changed

4 files changed

+14
-8
lines changed

plugins/default/src/Ide/LocalBindings.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import Data.Maybe
2121
import Data.Ord
2222
import Data.Set (Set)
2323
import qualified Data.Set as S
24-
import Development.IDE.GHC.Compat (TypecheckedModule (..), GhcTc, NoExt (..), RefMap, identType)
24+
import Development.IDE.GHC.Compat (TypecheckedModule (..), GhcTc, noExt, RefMap, identType)
2525
import HsBinds
2626
import HsExpr
2727
import Id
@@ -208,7 +208,7 @@ holify (Bindings _ local) v@(L span (HsVar _ (L _ var))) =
208208
-- Make sure the binding is not in scope and that it begins with an
209209
-- underscore
210210
case not (S.member var binds) && take 1 (occNameString occ) == "_" of
211-
True -> L span $ HsUnboundVar NoExt $ TrueExprHole occ
211+
True -> L span $ HsUnboundVar noExt $ TrueExprHole occ
212212
False -> v
213213
holify _ v = v
214214

plugins/default/src/Ide/Plugin/Tactic/Machinery.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ import TysWiredIn (listTyCon, pairTyCon, intTyCon, floatTyCon, doubleT
3838
------------------------------------------------------------------------------
3939
-- | Orphan instance for producing holes when attempting to solve tactics.
4040
instance MonadExtract (LHsExpr GhcPs) ProvableM where
41-
hole = pure $ noLoc $ HsVar NoExt $ noLoc $ Unqual $ mkVarOcc "_"
41+
hole = pure $ noLoc $ HsVar noExt $ noLoc $ Unqual $ mkVarOcc "_"
4242

4343

4444
------------------------------------------------------------------------------
@@ -239,7 +239,7 @@ buildDataCon hy dc apps = do
239239
pure
240240
. noLoc
241241
. foldl' (@@)
242-
(HsVar NoExt $ noLoc $ Unqual $ nameOccName $ dataConName dc)
242+
(HsVar noExt $ noLoc $ Unqual $ nameOccName $ dataConName dc)
243243
$ fmap unLoc sgs
244244

245245

plugins/default/src/Ide/Plugin/Tactic/Tactics.hs

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,14 @@ import Name
2525
import Refinery.Tactic
2626
import TcType
2727
import TyCoRep
28-
import Type
28+
import Type hiding (Var)
2929

3030

31+
------------------------------------------------------------------------------
32+
-- | Like 'var', but works over standard GHC 'OccName's.
33+
var' :: Var a => OccName -> a
34+
var' = var . fromString . occNameString
35+
3136
------------------------------------------------------------------------------
3237
-- | Like 'bvar', but works over standard GHC 'OccName's.
3338
bvar' :: BVar a => OccName -> a
@@ -39,7 +44,7 @@ bvar' = bvar . fromString . occNameString
3944
assumption :: TacticsM ()
4045
assumption = rule $ \(Judgement hy g) ->
4146
case find ((== g) . snd) $ toList hy of
42-
Just (v, _) -> pure $ noLoc $ HsVar NoExt $ noLoc $ Unqual v
47+
Just (v, _) -> pure $ noLoc $ var' v
4348
Nothing -> throwError $ GoalMismatch "assumption" g
4449

4550

@@ -81,7 +86,7 @@ destruct' f term = rule $ \(Judgement hy g) -> do
8186
Nothing -> throwError $ GoalMismatch "destruct" g
8287
Just (tc, apps) -> do
8388
fmap noLoc
84-
$ case' (HsVar NoExt $ noLoc $ Unqual term)
89+
$ case' (var' term)
8590
<$> do
8691
for (tyConDataCons tc) $ \dc -> do
8792
let args = dataConInstArgTys dc apps
@@ -125,7 +130,7 @@ apply = rule $ \(Judgement hy g) -> do
125130
let (args, _) = splitFunTys ty
126131
sgs <- traverse (newSubgoal hy . CType) args
127132
pure . noLoc
128-
. foldl' (@@) (HsVar NoExt $ noLoc $ Unqual func)
133+
. foldl' (@@) (var' func)
129134
$ fmap unLoc sgs
130135
Nothing -> throwError $ GoalMismatch "apply" g
131136

stack-8.6.4.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ extra-deps:
2828
- ghc-exactprint-0.6.2
2929
- ghc-lib-parser-8.10.1.20200523
3030
- ghc-lib-parser-ex-8.10.0.4
31+
- ghc-source-gen-0.4.0.0
3132
- haddock-api-2.22.0@rev:1
3233
- haddock-library-1.8.0
3334
- haskell-lsp-0.22.0.0

0 commit comments

Comments
 (0)