git.iko.soy/rowtype-yoga/purescript-yoga-json
on main help sign in
Improve path for object errors
commit5d39e7ad951950821143def27154c4193bbaa89c authorMark Eibes <mark.eibes@gmail.com> dateThu 21 Jul 2022, 16:39 (4 years ago) parent9590f73
1 file changed+4−1
src/Yoga/JSON.purs+4−1
src/Yoga/JSON.purs+4−1
@@ -242,8 +242,11 @@ instance (ReadForeign a, ReadForeign b) ⇒ ReadForeign (Either a b) where
242242 _ -> except $ Left (pure $ ForeignError $ "Invalid Either tag " <> tpe)
243243
244244instance ReadForeign a ⇒ ReadForeign (Object.Object a) where
245− readImpl = sequence <<< Object.mapWithKey (const readImpl) <=< readObject'
245+ readImpl = sequence <<< Object.mapWithKey readProp <=< readObject'
246246 where
247+ readProp key value = except $ lmap (map (ErrorAtProperty key))
248+ (readImpl value # runExcept)
249+
247250 readObject' ∷ Foreign → F (Object Foreign)
248251 readObject' value
249252 | tagOf value == "Object" = pure $ unsafeFromForeign value