Some utils for Simple-JSON. Nothing but a bunch of functions made for my own usage.
from tests
readPrintError :: forall a. ReadForeign a => String -> Proxy a -> Maybe String
readPrintError json _ = do
case readJSON json of
Right (_ :: a) -> Nothing
Left e -> Just $ printMultipleErrors e
TypeMismatch: expected: String, actual: Boolean
ErrorAtIndex 0:
TypeMismatch: expected: String, actual: Boolean
ErrorAtProperty "a":
TypeMismatch: expected: String, actual: Boolean
ErrorAtProperty "a":
ErrorAtProperty "b":
ErrorAtProperty "c":
TypeMismatch: expected: String, actual: Boolean