So, I figured out the algorithm, but I stumbled upon what seems like a compiler bug.
The solution is basically this:
export const canonicalizeTypedProps = function(props) {
for (var k in props) {
if (!props.hasOwnProperty(k)) // skip <prototype> properties
continue;
if (props[k] instanceof Array)
continue; // TODO: recurse into
if (props[k].constructor.name !== 'Object')
props[k] = show_(props[k]);
}
return props;
}
Here the show_ is a re-export of show, like this (I haven’t found a way to make it visible to the JS without re-declaring, suggestions are welcome):
show_ :: ∀ a. Show a => a -> String
show_ = show
Now, the problem is, show_ doesn’t work. Calling it upon “showable” property just gives undefined. More over, if I spago bundle-app and check resulting index.js for the string to produce, it turns out there’s none, so it doesn’t seem like it even produces a working code for show_.
Reported… But as far as the question concerned, marking as SOLVED.