-
Notifications
You must be signed in to change notification settings - Fork 52
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
Add missing ToJSON instances #347
Comments
We would probably want to create a custom class given that we need some environment references. Though at the top level I would not mind just splicing in the entire |
What about CESK machine, is it possible to implement the full serialization of its state and the continuation Frames? Or is there a more desirable encoding strategy? It seems like we would need to add many instances, should they be added to each modules, or should we collect them all in an extra module using orphaned instances? |
It is definitely possible to fully serialize a CESK machine --- in fact, part of the original reason I chose to use something like a CESK machine is that it represents higher-order functional programs in a completely first-order way, making it possible to serialize them. (As mentioned elsewhere, |
At the moment it seems we have gone with having each instance live in the same module as the data type it is for, so I guess we should stick with that approach for now. There are pros and cons to either choice. |
The autodocodec package has a lot features we want and looks nice: It might be worth investigating if it can work with select parts requiring environment. |
I'm unsure at this point which types are still missing https://discourse.haskell.org/t/listing-types-with-or-without-a-certain-type-class-instance/6687 More relevant info: https://gitlab.haskell.org/ghc/ghc/-/wikis/hie-files Some Template Haskell code that may be helpful:
|
At this point I think we have |
I would like to have
ToJSON
to complement the currentFromJSON
.ToJSON Scenario
would solve 99% of Saving and loading games #50! But for purposes of this issue adding most of the necessary instances would already be great.ToJSONE
, consider making the class generate JSON Schema for free and solve Export JSON schema for scenarios #346.The text was updated successfully, but these errors were encountered: