Closed jacereda closed 6 years ago
I'll work later on this to extend it to Fn2
and friends. I think it could simplify some FFI code.
I don't get what this is for, why should we have this? Is there a function representation for this? I think you should newtype specific functions you want to use with WriteForeign if that comes up, this is a JSON library more than anything.
Sometimes you want to pass a record to a JS library and one of the fields happens to be a callback. I think this can help in those cases.
To avoid newtype boilerplate, I mean.
I think this shouldn't go in this library since it doesn't relate to JSON and it would give people invalid code that tries to stringify functions, which is something you never want
I also feel this belongs in something like -foreign-generic, but AFAIK it lacks the records magic that makes this library so cool for interfacing to external JS libraries.
As I see it, this library presents 2 different use cases, generating JSON and generating Foreign
. I'm not thinking in the JSON part, but in the Foreign
one.
It might work for a generic Foreign library since that doesn't promise anything other than working with Foreign, but I really would rather not deal with this here. If anything, the "WriteForeign" class has some implicit law about "only data that can be represented in JSON"
Understood, closing.
Thoughts?