@@ -18,7 +18,7 @@ import Swarm.Failure (SystemFailure, simpleErrorHandle)
1818import Swarm.Game.CESK (initMachine )
1919import Swarm.Game.Cosmetic.Display (defaultRobotDisplay )
2020import Swarm.Game.Location
21- import Swarm.Game.Robot (TRobot , mkRobot )
21+ import Swarm.Game.Robot (Robot , mkRobot )
2222import Swarm.Game.Robot.Walk (emptyExceptions )
2323import Swarm.Game.Scenario (loadStandaloneScenario )
2424import Swarm.Game.Scenario.Status
@@ -38,13 +38,13 @@ import Swarm.Util.Erasable
3838import Test.Tasty.Bench (Benchmark , bcompare , bench , bgroup , defaultMain , whnfAppIO )
3939
4040-- | The program of a robot that does nothing.
41- idleProgram :: TSyntax
41+ idleProgram :: Syntax Elaborated
4242idleProgram = [tmQ | {} |]
4343
4444-- | The program of a robot which waits a random number of ticks, changes its
4545-- appearance, then waits another random number of ticks, places a tree, and
4646-- then self-destructs.
47- treeProgram :: TSyntax
47+ treeProgram :: Syntax Elaborated
4848treeProgram =
4949 [tmQ |
5050 {
@@ -59,15 +59,15 @@ treeProgram =
5959 |]
6060
6161-- | The program of a robot that moves forward forever.
62- moverProgram :: TSyntax
62+ moverProgram :: Syntax Elaborated
6363moverProgram =
6464 [tmQ |
6565 let forever : Cmd Unit -> Cmd Unit = \c. c; forever c
6666 in forever move
6767 |]
6868
6969-- | The program of a robot that moves in circles forever.
70- circlerProgram :: TSyntax
70+ circlerProgram :: Syntax Elaborated
7171circlerProgram =
7272 [tmQ |
7373 let forever : Cmd Unit -> Cmd Unit = \c. c; forever c
@@ -91,13 +91,13 @@ circlerProgram =
9191-- This is used to compare the performance degradation caused
9292-- by using definitions and chains of ifs. Ideally there should
9393-- not be cost if the code is inlined and simplified. TODO: #1557
94- waveProgram :: Bool -> TSyntax
94+ waveProgram :: Bool -> Syntax Elaborated
9595waveProgram manualInline =
96- let inlineDef = if manualInline then (1 :: Integer ) else 0
96+ let _inlineDef = if manualInline then (1 :: Integer ) else 0
9797 in [tmQ |
9898 def doN = \n. \f. if (n > 0) {f; doN (n - 1) f} {}; end;
9999 def crossPath =
100- if ($int:inlineDef == 0) {
100+ if ($int:_inlineDef == 0) {
101101 doN 6 move;
102102 } {
103103 move; move; move; move; move; move;
@@ -119,7 +119,7 @@ waveProgram manualInline =
119119 |]
120120
121121-- | Initializes a robot with program prog at location loc facing north.
122- initRobot :: TSyntax -> Location -> TRobot
122+ initRobot :: Syntax Elaborated -> Location -> Robot Elaborated
123123initRobot prog loc =
124124 mkRobot
125125 Nothing
@@ -138,7 +138,7 @@ initRobot prog loc =
138138
139139-- | Creates a GameState with numRobot copies of robot on a blank map, aligned
140140-- in a row starting at (0,0) and spreading east.
141- mkGameState :: TSyntax -> (Location -> TRobot ) -> Int -> IO GameState
141+ mkGameState :: Syntax Elaborated -> (Location -> Robot Elaborated ) -> Int -> IO GameState
142142mkGameState prog robotMaker numRobots = do
143143 let robots = [robotMaker (Location (fromIntegral x) 0 ) | x <- [0 .. numRobots - 1 ]]
144144
@@ -208,7 +208,7 @@ main = do
208208 robotNumbers = [10 , 20 .. 40 ]
209209 largeRobotNumbers = take 4 $ iterate (* 2 ) 100
210210
211- mkGameStates :: [Int ] -> TSyntax -> IO [(Int , GameState )]
211+ mkGameStates :: [Int ] -> Syntax Elaborated -> IO [(Int , GameState )]
212212 mkGameStates botCounts prog = mapM (traverse (mkGameState prog $ initRobot prog) . dupe) botCounts
213213
214214 toBenchmarks :: Int -> [(Int , GameState )] -> [Benchmark ]
0 commit comments