A datatype representing fetched data.
If you find yourself continually using Maybe (Result Error a) to
represent loaded data, or you have a habit of shuffling errors away to
where they can be quietly ignored, consider using this. It makes it
easier to represent the real state of a remote data fetch and handle
it properly.
While RemoteData can accept any type of error, the most common
one you'll actually use is when you fetch data from a REST interface,
and get back RemoteData Http.Error a. Because that case is so
common, WebData is provided as a useful alias.
Map a function into the Success value.
Map a function into the Failure value.
Map function into both the Success and Failure value.
Return the Success value, or the default.
Convert a Result Error, probably produced from elm-http, to a RemoteData value.
Convert a web Task, probably produced from elm-http, to a Cmd (RemoteData e a).
Monoidal append - join two RemoteData values together as though
they were one. If both values are Failure, the left one wins.
State-checking predicate. Returns true if we've successfully loaded some data.
Frequently when you're fetching data from an API, you want to represent four different states: *
NotAsked- We haven't asked for the data yet. *Loading- We've asked, but haven't got an answer yet. *Failure- We asked, but something went wrong. Here's the error. *Success- Everything worked, and here's the data.