diff --git a/app/Main.hs b/app/Main.hs index 958f45b5f..7c9eda87b 100644 --- a/app/Main.hs +++ b/app/Main.hs @@ -3,6 +3,7 @@ module Main where +import Data.Foldable (asum) import Data.Text ( Text, pack, @@ -15,7 +16,6 @@ import Swarm.DocGen (EditorType (..), GenerateDocs (..), generateDocs) import Swarm.Language.LSP (lspMain) import Swarm.Language.Pipeline (processTerm) import System.Exit -import Data.Foldable (asum) data CLI = Run @@ -49,11 +49,12 @@ cliParser = , command "editors" (info (EditorKeywords <$> editor <**> helper) $ progDesc "Output editor keywords") ] editor :: Parser (Maybe EditorType) - editor = asum - [ pure Nothing - , Just VSCode <$ switch (long "code" <> help "Generate for the VS Code editor") - , Just EMacs <$ switch (long "emacs" <> help "Generate for the EMacs editor") - ] + editor = + asum + [ pure Nothing + , Just VSCode <$ switch (long "code" <> help "Generate for the VS Code editor") + , Just EMacs <$ switch (long "emacs" <> help "Generate for the EMacs editor") + ] seed :: Parser (Maybe Int) seed = optional $ option auto (long "seed" <> short 's' <> metavar "INT" <> help "Seed to use for world generation") scenario :: Parser (Maybe String) diff --git a/src/Swarm/DocGen.hs b/src/Swarm/DocGen.hs index 74e738128..b5b5ee04c 100644 --- a/src/Swarm/DocGen.hs +++ b/src/Swarm/DocGen.hs @@ -33,7 +33,7 @@ import Swarm.Game.Recipe (Recipe, loadRecipes, recipeInputs, recipeOutputs, reci import Swarm.Game.Robot (installedDevices, robotInventory, setRobotID) import Swarm.Game.Scenario (Scenario, loadScenario, scenarioRobots) import Swarm.Game.WorldGen (testWorld2Entites) -import Swarm.Language.Syntax (ConstMeta (..), Const (..)) +import Swarm.Language.Syntax (Const (..), ConstMeta (..)) import Swarm.Language.Syntax qualified as Syntax import Swarm.Util (isRightOr) import Text.Dot (Dot, NodeId, (.->.)) @@ -70,7 +70,7 @@ generateDocs = \case putStrLn $ "-- " <> show et putStrLn $ replicate 40 '-' generateEditorKeywords et - mapM_ editorGen [minBound..maxBound] + mapM_ editorGen [minBound .. maxBound] -- ---------------------------------------------------------------------------- -- GENERATE KEYWORDS: LIST OF WORDS TO BE HIGHLIGHTED @@ -99,7 +99,7 @@ builtinCommandsEMacs = [If, Run, Return, Try, Fail, Force, Fst, Snd] editorList :: EditorType -> [Text] -> Text editorList = \case EMacs -> T.unlines . map ((" " <>) . quote) - VSCode -> T.intercalate "|" + VSCode -> T.intercalate "|" where quote = T.cons '"' . flip T.snoc '"'