purescript-json icon indicating copy to clipboard operation
purescript-json copied to clipboard

Should JArray operations be FFI like JObject?

Open natefaubion opened this issue 2 years ago • 1 comments

In https://github.com/purescript/purescript-json/pull/1 Array JSON was turned into JArray. I think this is a useful thing to do and a good assumption that a JArray is not necessarily an Array. However all JArray operation are implemented in terms of toArray. So we've changed the assumption from "It's always an Array" to "In order to observe anything, it must be converted to an Array". This implies that there is a 0-cost conversion to Array, since that would be the only way one could write performant codecs. Should JArray operations be FFI like JObject?

natefaubion avatar Sep 03 '23 18:09 natefaubion

Yeah, for sure. I was just being lazy at the time, primarily wanted to get JArray as a type in before anyone looked at using the library.

garyb avatar Sep 03 '23 19:09 garyb