[Ur] How to design JSON interface?
Adam Chlipala
adamc at impredicative.com
Wed Dec 1 09:46:45 EST 2010
Marc Weber wrote:
> I'd like to implement toJson and fromJson which can read typed values
> from json representation and back automatically.
>
> I still don't know how to represent this in urweb:
>
I'm sorry if I didn't say this clearly before: The way I would implement
this involves modifying the compiler in a not especially modular way.
This would naturally be a mirror of the current support for encoding
arbitrary values into URLs with the new format I made up. I'll be very
impressed if you're able to figure out how to implement this.
I still don't understand yet why you want JSON. Can you explain? Maybe
I can talk you out of it. :-)
> I found:
> - the eq class in basis.ur - but the implementation of mkEq is written
> in ml (?)
>
Yes, though this particular case would be easy to implement in Ur code.
The issue is just with automatic, generic handling of records and datatypes.
> - the classes in tests/ - but those methods don't take a type of t
> worse: When copy pasting type_classMod2.ur into my own .ur file it
> fails to compile:
>
I mask out the tests when building distributions for a reason: a lot of
them don't compile anymore. :-)
More information about the Ur
mailing list