Skip to content

Instantly share code, notes, and snippets.

@chriswk
Created July 8, 2016 11:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chriswk/82546019068fdf6b896beb3d6a83fc1c to your computer and use it in GitHub Desktop.
Save chriswk/82546019068fdf6b896beb3d6a83fc1c to your computer and use it in GitHub Desktop.
Minimal example
module Topbar exposing (..)
import Http
import Task exposing (..)
type Msg =
NoOp
| Error Http.Error
| Success String
makeHttpCall : String -> Task Http.Error String
makeHttpCall url =
Http.getString url
performHttp : Cmd Msg
performHttp =
Task.perform Error Success makeHttpCall
update : Msg -> Model -> (Model, Cmd)
update msg model =
case msg of
NoOp -> model ! []
Error _ -> model ! []
Success content -> { model | content = content } ! []
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment