JavaScript reference marshalling through GHC.Generics