Created
July 8, 2016 11:04
-
-
Save chriswk/82546019068fdf6b896beb3d6a83fc1c to your computer and use it in GitHub Desktop.
Minimal example
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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