Consolidate "FFI" and "FFI tips"
It have been asked a few times on IRC:
- "How do I return an
Either String Intfrom JS?" - "How do I return
MyCustomDatatypefrom JS?"
Two solutions that were brought up were to:
- send the possible data constructors to be return (example,
Left,Right, MyCustomDatatypeConstructor`, etc.), - send a function of type
String :: Maybe MyCustomDatatypethat will get a string version of that constructor and will decide which value to return based on that.
It'd be great if that'd be documented in the FFI guide. :)
What, like this? :smile:
Agreed it should be more prominent / perhaps expanded though.
Ah, sorry! I skimmed the document a few times and concluded that part wasn't documented but here it is...
It's under "FFI Tips" rather than just "FFI" in the guides, we should probably consolidate them :)
Oh nice! I didn't know that was documented. We need to improve the organization of this repo.
oh, missed it again. Yeah it would definitely help to merge the two guides.
There's also an FFI page under "language". I think we should try to put it all under the language one.