Get rid of run command and convert all scenarios to use import#2679
Get rid of run command and convert all scenarios to use import#2679mergify[bot] merged 26 commits intomainfrom
run command and convert all scenarios to use import#2679Conversation
xsebek
left a comment
There was a problem hiding this comment.
Wow, this is awesome! 👍 And you even went ahead and got rid of the IO! 🚀
|
Currently the and validating the scenario description did not involve loading and in order to validate the scenario we must typecheck the solution, which includes recursively loading Edited to add: it seems like the swarm/src/swarm-tournament/Swarm/Web/Tournament/Validate.hs Lines 183 to 185 in e0b64c7 already just takes the content of a .yaml file as input; then it in turn calls initScenarioObject:which in turn is forced to call parseJSONE' Nothing:The first argument to parseJSONE' is supposed to be the provenance of the file being parsed, but at this point it is too late, we only have the file's contents.
Edited to add 2: even if I figured out the above issue, I don't think this is going to work... the scenario validation calls @kostmo any thoughts on this? Edited to add 3: Just commenting out the |
Merge Queue Status✅ The pull request has been merged at 946e4bf This pull request spent 5 seconds in the queue, with no time running CI. Required conditions to merge
|
Fixes #2227. Partially reverts #1877. The motivation for #1877 was largely because of errors being shown by the `run` command, when the `.sw` file being loaded did not parse or type check. Such errors could be quite large, and were irrelevant once the `.sw` file had been fixed, so making them "ephemeral" worked very well. However, with #2540 and #2679 `run` has now been replaced by `import`, which generates not *runtime* errors but *compile-time* errors. Such errors are shown in the REPL console rather than a robot log, so the original motivation for #1877 is now moot. The remaining runtime errors tend to be short (*e.g* "move: There is a mountain in the way!") and potentially relevant to see in the log history, so making them ephemeral does not make as much sense.
#2695) Fixes #2227. Partially reverts #1877. The motivation for #1877 was largely because of errors being shown by the `run` command, when the `.sw` file being loaded did not parse or type check. Such errors could be quite large, and were irrelevant once the `.sw` file had been fixed, so making them "ephemeral" worked very well. However, with #2540 and #2679 `run` has now been replaced by `import`, which generates not *runtime* errors but *compile-time* errors. Such errors are shown in the REPL console rather than a robot log, so the original motivation for #1877 is now moot. The remaining runtime errors tend to be short (*e.g* "move: There is a mountain in the way!") and potentially relevant to see in the log history, so making them ephemeral does not make as much sense.
In this PR:
runcommand (good riddance!)IOfrom the runtime engine, and introduce new effects for the things we were still usingIOfor: (1) mutable global cache and (2) getting the current timeLanguage.Syntax.Importinto multiple modulesgetDataDirSafetogetDataDirThrowsince it actually throws an exception, and create an actually safe variant~swarmas an import anchor to refer to things in the Swarm data dir, so you can write e.g.import "~swarm/lib/control"in order to importdata/lib/control.swfrom wherever it got installedimport:run "foo.sw"andfoo.swcontaineddef ...; def ...; gowe removegofrom the end offoo.swand changerun "foo.sw"toimport "foo"; goCloses #495. Closes #328. Closes #2068. Closes #2182. Closes #1560. Closes #2602.