Skip to content

Instantly share code, notes, and snippets.

@jhrcek
Last active May 24, 2019 13:51
Show Gist options
  • Select an option

  • Save jhrcek/1cebd19480e574a49230a310242ad20b to your computer and use it in GitHub Desktop.

Select an option

Save jhrcek/1cebd19480e574a49230a310242ad20b to your computer and use it in GitHub Desktop.
Are requests sent, when `Cmd.map (always NoOp) requestCmd`?
module Main exposing (main)
import Browser
import Html exposing (Html)
import Http
type Msg
= GotText (Result Http.Error String)
| NoOp
getPublicOpinion : Cmd Msg
getPublicOpinion =
Http.get
{ url = "https://elm-lang.org/assets/public-opinion.txt"
, expect = Http.expectString GotText
}
main : Program () () Msg
main =
Browser.element
{ init = init
, view = view
, update = update
, subscriptions = always Sub.none
}
init : () -> ( (), Cmd Msg )
init _ =
( (), Cmd.map (always NoOp) getPublicOpinion )
update : Msg -> () -> ( (), Cmd Msg )
update msg model =
( model, Cmd.none )
view : () -> Html Msg
view () =
Html.text ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment