[{"name":"Loadable","comment":" This module helps you model values loaded, for example, from a database over Http/GraphQL.\n\nThese three definitions are the bread and butter of the module:\n\n1.  Add a loadable to your model-definition.\n2.  Request some data, and update your loadable to expect it.\n3.  Receive a result, and transform it into a loadable, that then goes into your model.\n\nThe next logical step is to model your views according to the model. For example with `mdgriffith/elm-ui`:\n\n```elm\nviewProductList : Loadable.FromHttp (List Product) -> Element Msg\nviewProductList products =\n    let\n        viewErrorAndRetry =\n             Loadable.toError products\n                |> Maybe.map (viewErrorAndRetryOverlay getProductsCmd)\n                |> Maybe.withDefault Element.none\n\n        viewLoading =\n            if Loadable.isLoading products then\n                viewLoadingIndicator\n            else\n                Element.none\n\n        productElements =\n             Loadable.toValue products\n                |> Maybe.map (List.indexedMap viewProductListItem)\n                |> Maybe.withDefault []\n    in\n    Element.column\n        [ Element.inFront viewErrorAndRetry,\n        , Element.inFront viewLoading\n        ]\n        productElements\n```\n\n@docs Loadable, expectUpdate, fromResult\n\n\n# Queries\n\n@docs isLoading, isStale, hasValue, hasError\n\n\n# Conversion\n\n@docs map, mapError, toValue, toError\n\n\n# Aliases\n\nUse these aliases to tidy up your model-definition\n\n@docs FromGraphql, FromHttp\n\n","unions":[{"name":"Loadable","comment":" A representation of data-loading. This would usually go into your model.\n","args":["error","value"],"cases":[["Idle",[]],["Loading",[]],["Success",["value"]],["Failure",["error"]],["Reloading",["value"]],["ReloadFailure",["error","value"]]]}],"aliases":[{"name":"FromGraphql","comment":" data over GraphQL is a good use-case for loadables.\n","args":["value"],"type":"Loadable.Loadable (Graphql.Http.Error value) value"},{"name":"FromHttp","comment":" data over Http is a good use-case for loadables.\n","args":["value"],"type":"Loadable.Loadable Http.Error value"}],"values":[{"name":"expectUpdate","comment":" Update your loadable to expect a new value. Use this when you expect a new value to arrive soon.\n","type":"Loadable.Loadable error value -> Loadable.Loadable error value"},{"name":"fromResult","comment":" Convert a result into a loadable. Use this when a new value arrives, and your loadable is expecting the update.\n","type":"Result.Result error value -> Loadable.Loadable error value"},{"name":"hasError","comment":" Has the loadable failed on the latest load or reload?\n","type":"Loadable.Loadable error value -> Basics.Bool"},{"name":"hasValue","comment":" Is any value, stale or otherwise, contained within the loadable?\n","type":"Loadable.Loadable error value -> Basics.Bool"},{"name":"isLoading","comment":" Is the loadable expecting a new value?\n","type":"Loadable.Loadable error value -> Basics.Bool"},{"name":"isStale","comment":" Does the loadable contain a stale value?\nStaleness implies a reload is underway or failed, in which case the value from the most recent load is available.\n","type":"Loadable.Loadable error value -> Basics.Bool"},{"name":"map","comment":" Transform the value of a loadable.\n","type":"(value -> otherValue) -> Loadable.Loadable error value -> Loadable.Loadable error otherValue"},{"name":"mapError","comment":" Transform the error of a loadable.\n","type":"(error -> otherError) -> Loadable.Loadable error value -> Loadable.Loadable otherError value"},{"name":"toError","comment":" Extract the error of a loadable, should there be one.\n","type":"Loadable.Loadable error value -> Maybe.Maybe error"},{"name":"toValue","comment":" Extract the value of a loadable, should there be one.\n","type":"Loadable.Loadable error value -> Maybe.Maybe value"}],"binops":[]}]