Construct an instance of <a href="../globals.html#decoderesult">DecodeResult</a>
. The only field that is shared
between <a href="decodesuccess.html">DecodeSuccess</a>
and <a href="decodefailure.html">DecodeFailure</a>
is input: In
.
These placeholder (_I
, _O
, _E
) types are not expected to bring any
value. They exist to allow inspecting the main types of a DecodeResult at
compile time.
See _E.
See _E.
Type discriminator
Transfom the result of a DecodeSuccess
into a new DecodeResult
by applying
the function f
to it.
Transfom the result of a DecodeFailure
into a new DecodeResult
by applying
the function f
to it. This operation allows to recover form a failed result.
Unwrap the result value of a DecodeFailure
. If the current instance is of
type DecodeSuccess
then this function will throw an exception.
Do not use unless you are protecting from exceptions.
Unwrap the result value of a DecodeSuccess
. If the current instance is of
type DecodeFailure
then this function will throw an exception.
Do not use unless you are protecting from exceptions.
Return true if the current instance is of type DecodeFailure
. It also
provide a guard value so that properties of DecodeFailure
can be used
in the right conditional scope.
Return true if the current instance is of type DecodeSuccess
. It also
provide a guard value so that properties of DecodeSuccess
can be used
in the right conditional scope.
Transfom the result of a DecodeSuccess
into a new value of type Out2
by
applying the function f
to the original Out
value.
Transfom the result of a DecodeFailure
into a new value of type Err2
by
applying the function f
to the original Err
value.
Transform the input value associated with the current DecodeResult
into
a new input of type In2
.
Transform an instance of <a href="../globals.html#decoderesult">DecodeResult</a>
into any type O
.
To perform the transformation an object is passed with 2 fields success
and failure
. Both fields must be populated with a function.
success
will take a function DecodeSuccess -> O
failure
will take a function DecodeFailure -> O
Provides a human readable representation of the value. Mostly for debugging.
DecodeResult is a union type that has two possible constructors DecodeSuccess and DecodeFailure.
DecodeResultBase
is abstract and should never be used directly. It is defined to provide a common signature to the only two possible constructors DecodeSuccess and DecodeFailure.See
<a href="../globals.html#decoderesult">DecodeResult</a>
.