packages feed

swarm 0.1.0.1 → 0.1.1.0

raw patch · 10 files changed

+67/−16 lines, 10 filesdep ~hsnoisePVP: major bump suggested

API removals or changes: PVP suggests a major version bump

Dependency ranges changed: hsnoise

API changes (from Hackage documentation)

+ Swarm.Game.State: replActiveType :: Getter REPLStatus (Maybe Polytype)
+ Swarm.Language.Types: pattern PolyUnit :: Polytype
- Swarm.Game.State: REPLDone :: REPLStatus
+ Swarm.Game.State: REPLDone :: Maybe (Polytype, Value) -> REPLStatus
- Swarm.Game.State: notificationsContent :: forall a_a4fKI a_a4ge2. Lens (Notifications a_a4fKI) (Notifications a_a4ge2) [a_a4fKI] [a_a4ge2]
+ Swarm.Game.State: notificationsContent :: forall a_a4fPh a_a4giB. Lens (Notifications a_a4fPh) (Notifications a_a4giB) [a_a4fPh] [a_a4giB]
- Swarm.Game.State: notificationsCount :: forall a_a4fKI. Lens' (Notifications a_a4fKI) Int
+ Swarm.Game.State: notificationsCount :: forall a_a4fPh. Lens' (Notifications a_a4fPh) Int
- Swarm.TUI.Border: bottomLabels :: forall n_a2hAH. Lens' (BorderLabels n_a2hAH) (HBorderLabels n_a2hAH)
+ Swarm.TUI.Border: bottomLabels :: forall n_a2hEi. Lens' (BorderLabels n_a2hEi) (HBorderLabels n_a2hEi)
- Swarm.TUI.Border: centerLabel :: forall n_a2hAI. Lens' (HBorderLabels n_a2hAI) (Maybe (Widget n_a2hAI))
+ Swarm.TUI.Border: centerLabel :: forall n_a2hEj. Lens' (HBorderLabels n_a2hEj) (Maybe (Widget n_a2hEj))
- Swarm.TUI.Border: leftLabel :: forall n_a2hAI. Lens' (HBorderLabels n_a2hAI) (Maybe (Widget n_a2hAI))
+ Swarm.TUI.Border: leftLabel :: forall n_a2hEj. Lens' (HBorderLabels n_a2hEj) (Maybe (Widget n_a2hEj))
- Swarm.TUI.Border: rightLabel :: forall n_a2hAI. Lens' (HBorderLabels n_a2hAI) (Maybe (Widget n_a2hAI))
+ Swarm.TUI.Border: rightLabel :: forall n_a2hEj. Lens' (HBorderLabels n_a2hEj) (Maybe (Widget n_a2hEj))
- Swarm.TUI.Border: topLabels :: forall n_a2hAH. Lens' (BorderLabels n_a2hAH) (HBorderLabels n_a2hAH)
+ Swarm.TUI.Border: topLabels :: forall n_a2hEi. Lens' (BorderLabels n_a2hEi) (HBorderLabels n_a2hEi)

Files

CHANGELOG.md view
@@ -1,5 +1,20 @@ # Revision history for swarm +## **0.1.1.0** - 2022-10-14++A couple new features and an important bugfix for the Hackage release.++- Update to `hsnoise-0.0.3`, fixing some world generation bugs that+  only showed up in the Hackage+  release. ([#746](https://github.com/swarm-game/swarm/pull/746))+- New "blank" creative scenario+  ([#741](https://github.com/swarm-game/swarm/pull/741))+- REPL improvements+    - `Ctrl-D` at an empty REPL prompt now triggers a quit+      ([#743](https://github.com/swarm-game/swarm/pull/743))+    - The REPL panel now persists in showing the type of the most+      recently evaluated expression ([#733](https://github.com/swarm-game/swarm/pull/733))+ ## **0.1.0.1** - 2022-10-06  A bugfix release for a few minor bugs that plagued the first release:
data/scenarios/00-ORDER.txt view
@@ -1,5 +1,6 @@ classic.yaml creative.yaml+blank.yaml Tutorials Challenges Fun
+ data/scenarios/blank.yaml view
@@ -0,0 +1,14 @@+version: 1+name: Blank world+description: No constraints and no obstacles!  Do whatever you want, in this empty void!+creative: true+robots:+  - name: base+    loc: [0,0]+    dir: [0,1]+    heavy: true+    display:+      char: Ω+      attr: robot+world:+  default: [grass]
src/Swarm/Game/State.hs view
@@ -62,6 +62,7 @@   needsRedraw,   replStatus,   replWorking,+  replActiveType,   messageQueue,   lastSeenMessageTime,   focusedRobotID,@@ -176,7 +177,8 @@ -- | A data type to represent the current status of the REPL. data REPLStatus   = -- | The REPL is not doing anything actively at the moment.-    REPLDone+    --   We persist the last value and its type though.+    REPLDone (Maybe (Polytype, Value))   | -- | A command entered at the REPL is currently being run.  The     --   'Polytype' represents the type of the expression that was     --   entered.  The @Maybe Value@ starts out as @Nothing@ and gets@@ -496,9 +498,17 @@ replWorking :: Getter GameState Bool replWorking = to (\s -> matchesWorking $ s ^. replStatus)  where-  matchesWorking REPLDone = False+  matchesWorking (REPLDone _) = False   matchesWorking (REPLWorking _ _) = True +-- | Either the type of the command being executed, or of the last command+replActiveType :: Getter REPLStatus (Maybe Polytype)+replActiveType = to getter+ where+  getter (REPLDone (Just (typ, _))) = Just typ+  getter (REPLWorking typ _) = Just typ+  getter _ = Nothing+ -- | Get the notification list of messages from the point of view of focused robot. messageNotifications :: Getter GameState (Notifications LogEntry) messageNotifications = to getNotif@@ -703,7 +713,7 @@       , _viewCenterRule = VCRobot 0       , _viewCenter = V2 0 0       , _needsRedraw = False-      , _replStatus = REPLDone+      , _replStatus = REPLDone Nothing       , _messageQueue = Empty       , _lastSeenMessageTime = -1       , _focusedRobotID = 0@@ -753,8 +763,8 @@       , -- When starting base with the run flag, REPL status must be set to working,         -- otherwise the store of definition cells is not saved (see #333)         _replStatus = case toRun of-          Nothing -> REPLDone-          Just _ -> REPLWorking (Forall [] (TyCmd TyUnit)) Nothing+          Nothing -> REPLDone Nothing+          Just _ -> REPLWorking PolyUnit Nothing       , _messageQueue = Empty       , _focusedRobotID = baseID       , _ticks = 0
src/Swarm/Language/LSP.hs view
@@ -14,6 +14,7 @@ import Control.Lens (to, (^.)) import Control.Monad (void) import Control.Monad.IO.Class+import Data.Foldable (forM_) import Data.Maybe (fromMaybe) import Data.Text (Text) import Data.Text.IO qualified as Text@@ -71,9 +72,7 @@           Left e -> Just $ showTypeErrorPos content e         Left e -> Just $ showErrorPos e   -- debug $ "-> " <> from (show err)-  case err of-    Nothing -> pure ()-    Just e -> sendDiagnostic e+  forM_ err sendDiagnostic  where   sendDiagnostic :: ((Int, Int), (Int, Int), Text) -> LspM () ()   sendDiagnostic ((startLine, startCol), (endLine, endCol), msg) = do
src/Swarm/Language/Typecheck.hs view
@@ -34,7 +34,7 @@   skolemize,   generalize, -  -- * Type inferen+  -- * Type inference   inferTop,   inferModule,   infer,
src/Swarm/Language/Types.hs view
@@ -58,6 +58,7 @@   -- * Polytypes   Poly (..),   Polytype,+  pattern PolyUnit,   UPolytype,    -- * Contexts@@ -366,6 +367,9 @@  pattern UTyDelay :: UType -> UType pattern UTyDelay ty1 = UTerm (TyDelayF ty1)++pattern PolyUnit :: Polytype+pattern PolyUnit = Forall [] (TyCmd TyUnit)  -- Derive aeson instances for type serialization deriving instance Generic Type
src/Swarm/TUI/Controller.hs view
@@ -583,7 +583,7 @@   replUpdated <- case g ^. replStatus of     -- It did, and the result was the unit value.  Just reset replStatus.     REPLWorking _ (Just VUnit) -> do-      gameState . replStatus .= REPLDone+      gameState . replStatus .= REPLDone (Just (PolyUnit, VUnit))       pure True      -- It did, and returned some other value.  Pretty-print the@@ -591,7 +591,7 @@     REPLWorking pty (Just v) -> do       let out = T.intercalate " " [into (prettyValue v), ":", prettyText (stripCmd pty)]       uiState . uiReplHistory %= addREPLItem (REPLOutput out)-      gameState . replStatus .= REPLDone+      gameState . replStatus .= REPLDone (Just (pty, v))       pure True      -- Otherwise, do nothing.@@ -747,6 +747,11 @@       CmdPrompt {} -> continueWithoutRedraw       SearchPrompt _ _ ->         uiState %= resetWithREPLForm (mkReplForm $ mkCmdPrompt "")+  ControlKey 'd' -> do+    text <- use $ uiState . uiReplForm . to formState . promptTextL+    if text == T.empty+      then toggleModal QuitModal+      else continueWithoutRedraw   ev -> do     replForm <- use $ uiState . uiReplForm     f' <- nestEventM' replForm (handleFormEvent ev)@@ -782,12 +787,16 @@ validateREPLForm :: AppState -> AppState validateREPLForm s =   case replPrompt of+    CmdPrompt "" _ ->+      let theType = s ^. gameState . replStatus . replActiveType+       in s & uiState . uiReplType .~ theType     CmdPrompt uinput _ ->       let result = processTerm' topTypeCtx topReqCtx uinput           theType = case result of             Right (Just (ProcessedTerm _ (Module ty _) _ _)) -> Just ty             _ -> Nothing-       in s & uiState . uiReplForm %~ validate result+       in s+            & uiState . uiReplForm %~ validate result             & uiState . uiReplType .~ theType     SearchPrompt _ _ -> s  where@@ -908,7 +917,7 @@ makeEntity :: Entity -> EventM Name AppState () makeEntity e = do   s <- get-  let mkTy = Forall [] $ TyCmd TyUnit+  let mkTy = PolyUnit       mkProg = TApp (TConst Make) (TText (e ^. entityName))       mkPT = ProcessedTerm mkProg (Module mkTy empty) (R.singletonCap CMake) empty       topStore =
src/Swarm/TUI/Model.hs view
@@ -904,7 +904,6 @@ resetWithREPLForm :: Form REPLPrompt AppEvent Name -> UIState -> UIState resetWithREPLForm f =   (uiReplForm .~ f)-    . (uiReplType .~ Nothing)     . (uiError .~ Nothing)  ------------------------------------------------------------
swarm.cabal view
@@ -1,6 +1,6 @@ cabal-version:      2.4 name:               swarm-version:            0.1.0.1+version:            0.1.1.0 synopsis:           2D resource gathering game with programmable robots  description:        Swarm is a 2D programming and resource gathering@@ -140,7 +140,7 @@                       fused-effects-lens            >= 1.2.0.1 && < 1.3,                       githash                       >= 0.1.6 && < 0.2,                       hashable                      >= 1.3.4 && < 1.5,-                      hsnoise                       >= 0.0.2 && < 0.1,+                      hsnoise                       >= 0.0.3 && < 0.1,                       http-client                   >= 0.7 && < 0.8,                       http-client-tls               >= 0.3 && < 0.4,                       http-types                    >= 0.12 && < 0.13,