Remote

type Remote a

A remotely loaded resource.

Create

loading : String -> Remote a

Initialize a loading resource with a description.

Manipulate

loaded : a -> Remote a -> Remote a

Store the loaded resource.

Set the loading status as failed.

Query

get : Remote a -> Maybe a

Return the resource if loaded.

description : Remote a -> String

Return the resource description.

View

view : (a -> Html msg) -> Remote a -> Html msg

View a loading message, the resource or an error according to the resource status. A viewer function is needed to turn the resource into an HTML element.

viewList : (a -> List (Html msg)) -> Remote a -> List (Html msg)

Like view but using a viewer that renders a List (Html msg).