-
Notifications
You must be signed in to change notification settings - Fork 53
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Refactor: move pretty-printing and failure code to swarm-util
#2155
Conversation
Generic pretty-printing infrastructure (`PrettyPrec` class, various utility functions, etc.) can move to `-util` so we can use it anywhere, for pretty-printing anything. All the specific instances are to be distributed so they live right next to the definitions of the associated data types.
Co-authored-by: Restyled.io <commits@restyled.io>
0cff520
to
7e1c67b
Compare
Co-authored-by: Restyled.io <commits@restyled.io>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, this looks much easier to discover. 👍 I look forward to seeing the haddock in the next release. 🙂
That reminds me, I haven't looked at the Haddocks in a long time, probably worth a pass at some point to make sure things are still well-explained, and putting more prominent links to the built Haddock documentation in our materials about "how to contribute". |
Now that failure stuff has been moved into `swarm-util` as of #2155.
Now that `Failure` is moved to `swarm-util` (#2155), that was the last remaining dependency of `Swarm.Game.ResourceLoading` which prevented it from moving as well. The `ResourceLoading` code is not specific to Swarm scenarios; this PR moves it to `swarm-util` to make it more generally applicable. In fact, the `ResourceLoading` code is already being used to load `.sw` files when executing the `Run` command; in order to implement #495 we will need to do that loading in order to resolve `import` expressions, but that code will live in `swarm-lang`, which cannot import `swarm-scenario`.
Now that failure stuff has been moved into `swarm-util` as of #2155.
Swarm.Language.Pretty
(in theswarm-lang
package) had a bunch of generic pretty-printing infrastructure along with a bunch of specific instances for terms and related things. However, the generic pretty-printing code infrastructure is not specific to swarm-lang. This PR:Swarm.Pretty
inswarm-util
to make it more generally applicable.PrettyPrec
instances to live next to the declarations of the corresponding data types.In addition,
Swarm.Game.Failure
(in theswarm-scenario
package) also had no dependencies on anything else inswarm-scenario
, so this PR also moves it toSwarm.Failure
inswarm-util
, to make it more generally applicable.Along the way I also removed
DelayType
andPrec
since they are no longer being used.