krisajenkins / remotedata

Tools for fetching data from remote sources (incl. HTTP).
MIT License
249 stars 23 forks source link

Some sort of withDefault for the failure state #38

Open jouderianjr opened 4 years ago

jouderianjr commented 4 years ago

The combo of RemoteData.map plus RemoteData.map is really common and useful. I just faced a situation that I would want to do the same, but caring about the Failure instead of Success case.

I have some typed error that I decode from the request and that I map to the Failure, then having the combo RemoteData.map plus RemoteData.withDefaultForError (something like that with a better name) It would be really nice. Do you think it worth adding to the library? I can handle with this modification.