Say we have a morally correct json library.
It comes with types like: JValue
, JObject
and Path
.
It also has error types extending JsonError
like ParsingError
, CastingError
and FieldError
. To make it even smarter, there's a sweet Semigroup[JsonError]
to accumulate errors properly (left as an exercise).
Finally, there are a bunch of basic combinators:
def parse(in: String): ParsingError \/ JValue