Skip to content

Commit 74d4e64

Browse files
committed
Tidy parser
1 parent b586b85 commit 74d4e64

File tree

1 file changed

+7
-15
lines changed
  • plugins/hls-tactics-plugin/src/Wingman/Metaprogramming

1 file changed

+7
-15
lines changed

plugins/hls-tactics-plugin/src/Wingman/Metaprogramming/Parser.hs

+7-15
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,15 @@ module Wingman.Metaprogramming.Parser where
88

99
import qualified Control.Monad.Combinators.Expr as P
1010
import Data.Functor
11-
import Development.IDE.GHC.Compat (alphaTyVars, LHsExpr, GhcPs)
12-
import GhcPlugins (mkTyVarTy)
11+
import qualified Data.Text as T
12+
import Development.IDE.GHC.Compat (LHsExpr, GhcPs)
1313
import qualified Refinery.Tactic as R
1414
import qualified Text.Megaparsec as P
1515
import Wingman.Auto
1616
import Wingman.LanguageServer.TacticProviders (useNameFromHypothesis)
1717
import Wingman.Metaprogramming.Lexer
1818
import Wingman.Tactics
1919
import Wingman.Types
20-
import qualified Data.Text as T
2120

2221

2322
nullary :: T.Text -> TacticsM () -> Parser (TacticsM ())
@@ -62,25 +61,18 @@ bindOne t t1 = t R.<@> [t1]
6261

6362
operators :: [[P.Operator Parser (TacticsM ())]]
6463
operators =
65-
[ [ P.Prefix (symbol "*" $> R.many_) ]
64+
[ [ P.Prefix (symbol "*" $> R.many_) ]
6665
, [ P.Prefix (symbol "try" $> R.try) ]
67-
, [ P.InfixR (symbol "|" $> (R.<%>) )]
68-
, [ P.InfixL (symbol ";" $> (>>))
69-
, P.InfixL (symbol "," $> bindOne)
66+
, [ P.InfixR (symbol "|" $> (R.<%>) )]
67+
, [ P.InfixL (symbol ";" $> (>>))
68+
, P.InfixL (symbol "," $> bindOne)
7069
]
7170
]
7271

7372

74-
skolems :: [Type]
75-
skolems = fmap mkTyVarTy alphaTyVars
76-
77-
a_skolem, b_skolem, c_skolem :: Type
78-
(a_skolem : b_skolem : c_skolem : _) = skolems
79-
80-
8173
attempt_it :: Context -> Judgement -> String -> Either String (LHsExpr GhcPs)
8274
attempt_it ctx jdg program =
83-
case P.runParser (sc *> tactic <* P.eof) "<splice>" (T.pack program) of
75+
case P.runParser (sc *> tactic <* P.eof) "<splice>" $ T.pack program of
8476
Left peb -> Left $ P.errorBundlePretty peb
8577
Right tt -> do
8678
case runTactic

0 commit comments

Comments
 (0)