Open xsebek opened 2 years ago
Update:
diophantus :: ~/projects/swarm » find src -name '*.hs' -exec wc -l {} \; | sort -h | tail -n 6
852 src/Swarm/Game/Step.hs
1126 src/Swarm/Language/Typecheck.hs
1208 src/Swarm/Language/Syntax.hs
1467 src/Swarm/TUI/View.hs
1503 src/Swarm/TUI/Controller.hs
1693 src/Swarm/Game/Step/Const.hs
We managed to split up Step
, though Step.Const
is still the longest module. Maybe the next place to focus some energy would be the TUI
modules as well as syntax + typechecking.
Update:
diophantus :: ~/projects/swarm » find src -name '*.hs' -exec wc -l {} \; | sort -h | tail -n 6
865 src/swarm-scenario/Swarm/Game/Entity.hs
873 src/swarm-engine/Swarm/Game/Step.hs
919 src/swarm-lang/Swarm/Language/Syntax/Constants.hs
1417 src/swarm-lang/Swarm/Language/Typecheck.hs
1484 src/swarm-tui/Swarm/TUI/View.hs
1779 src/swarm-engine/Swarm/Game/Step/Const.hs
Some of the Swarm Haskell modules have grown exceedingly large, which makes them hard to maintain.
Notably:
It also makes compilation slightly longer, since any change causes the recompilation of the entire file and its dependencies.
Proposed solution
The
Step
module is the largest one and the trickiest to split. But I think it could be reasonably split into three parts:Exec
:execConst
function which currently accounts for ~1000 locStep
: running CESK machines (stepCESK
,evalPT
,...)Util
module, others could be moved toRobot
orGameState
I think we could make room for the utility functions on robots and game state if we moved the records themselves into an internal module.
For example, if we moved the
GameState
record and its lenses:This could of course be tweaked for documentation so that the
Step
module renders nicely.