Decodes encoded data.
Decodes encoded data.
This method is safe, in that it won't throw for run-of-the-mill errors. Unrecoverable errors such as out of memory exceptions are still thrown, but that's considered valid exceptional cases, where incorrectly encoded data is just... normal.
Callers that wish to fail fast and fail hard can use the unsafeDecode method instead.
Creates a new Decoder instance by transforming raw results with the specified function.
Creates a new Decoder instance by transforming raw results with the specified function.
Most of the time, other combinators such as map should be preferred. andThen is mostly useful when one needs to turn failures into successes, and even then, recover or recoverWith are probably more directly useful.
Creates a new Decoder instance by transforming encoded values with the specified function.
Creates a new Decoder instance by transforming successful results with the specified function.
Creates a new Decoder instance by transforming errors with the specified function.
Creates a new Decoder instance by transforming successful results with the specified function.
Creates a new Decoder instance by transforming some failures into successes with the specified function.
Creates a new Decoder instance by transforming some failures with the specified function.
Changes the type with which the decoder is tagged.
Changes the type with which the decoder is tagged.
This makes it possible to share similar decoders across various libraries. Extracting values from strings, for example, is a common task for which the default implementation can be shared rather than copy / pasted.
Decodes encoded data unsafely.
Decodes encoded data unsafely.
The main difference between this and decode is that the former throws exceptions when errors occur where the later safely encodes error conditions in its return type.
decode should almost always be preferred, but this can be useful for code where crashing is an acceptable reaction to failure.
Type class for types that can be decoded from other types.
encoded type - what to decode from.
decoded type - what to decode to.
failure type - how to represent errors.
tag type - used to specialise decoder instances, and usually where default implementations are declared.