toastal / either / Either.Decode

Provides a JSON Decoder for the Either type.

Definition

either : Json.Decode.Decoder a -> Json.Decode.Decoder b -> Json.Decode.Decoder (Either a b)

Decode an Either from a JSON Value.

decodeString (either string int) "4" == Ok (Right 4)