Requesting Show Instance
eric-corumdigital opened this issue · 2 comments
showJson ∷ Json → String
showJson = Argo.caseJson
(\_ → "jsonNull")
(\x → "(fromBoolean " <> show x <> ")")
(\x → "(fromNumber " <> show x <> ")")
(\x → "(fromString " <> show x <> ")")
(\x → "(fromArray " <> show (map showJson x) <> ")")
(\x → "(fromObject " <> show (map showJson x) <> ")")
This isn't quite the same thing, but the stringify function can be used to print Json to a string. If you just need to make comparisons, perhaps that would work?
That said, you're suggesting a traditional Show instance, not something that produces valid JSON, so I'm assuming that would not suffice. I'd like to defer to @garyb and others as to why, exactly, the original Show instance was removed. If I remember correctly it was because the Show class is meant to represent how PureScript represents things, which your suggestion does, whereas the old Show produced stringified JSON.
I do not have a problem adding a Show instance for debugging purposes, but I'd appreciate weigh-in from other maintainers before adding it.
I'm going to close this for inactivity, but I can reopen the issue if needed.