Closed mlms13 closed 1 year ago
null is a valid JSON value, so it makes sense to have a decoder that succeeds only if it encounters the literal null value.
null
On its own, it probably isn't the most useful decoder, but it should allow us to rewrite the optional decoder as
optional
let optional = decoder => alt(null |> map(() => None), decoder |> map(Option.pure))
Not going to change the implementation of optional for 1.x because that would actually change the error that comes out of optional decoders. This will change in 2.0, though.
null
is a valid JSON value, so it makes sense to have a decoder that succeeds only if it encounters the literalnull
value.On its own, it probably isn't the most useful decoder, but it should allow us to rewrite the
optional
decoder as