Closed OliverJAsh closed 1 year ago
thereby allowing us to drop the default case
Potentially, but not always. See the real example here (also in the OP) which does still need the default case: https://github.com/unsplash/unsplash-web/pull/10389/files#diff-975bd6118660e97d61a5671631b8c0d1ba7a88aa181bc2e46dd502a9d2d74f01R33
Previously
getCodecFromMappedNullaryTag
only allowed decoding fromunknown
. With this PR the input type is now generic, allowing for better composition of codecs. For example, if we want to compose the codec forCountry
to create a new codec forWeather
, we can doCountry.pipe(getCodecFromMappedNullaryTag(…)(…)(…)
:For reference, this is the motivating real world use case from unsplash-web: