Package

purescript-simple-json-utils

Repository
justinwoo/purescript-simple-json-utils
License
MIT
Uploaded by
justinwoo
Published on
2019-04-24

Build Status

Some utils for Simple-JSON. Nothing but a bunch of functions made for my own usage.

Printing MultipleErrors

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