Permalink
Browse files

Update all examples for 0.18

  • Loading branch information...
evancz committed Oct 12, 2016
1 parent ee19bd8 commit 1d6a46cb0b15dc62499166131fc1b9b956ec3f21
View
@@ -8,12 +8,12 @@
],
"exposed-modules": [],
"dependencies": {
- "elm-lang/core": "4.0.0 <= v < 5.0.0",
- "elm-lang/html": "1.0.0 <= v < 2.0.0",
- "elm-lang/svg": "1.0.0 <= v < 2.0.0",
- "elm-lang/websocket": "1.0.0 <= v < 2.0.0",
- "evancz/elm-http": "3.0.1 <= v < 4.0.0",
- "evancz/elm-markdown": "3.0.0 <= v < 4.0.0"
+ "elm-lang/core": "5.0.0 <= v < 6.0.0",
+ "elm-lang/html": "2.0.0 <= v < 3.0.0",
+ "elm-lang/http": "1.0.0 <= v < 2.0.0",
+ "elm-lang/svg": "2.0.0 <= v < 3.0.0",
+ "elm-lang/websocket": "1.0.2 <= v < 2.0.0",
+ "evancz/elm-markdown": "3.0.1 <= v < 4.0.0"
},
- "elm-version": "0.17.0 <= v < 0.18.0"
-}
+ "elm-version": "0.18.0 <= v < 0.19.0"
+}
View
@@ -1,5 +1,4 @@
import Html exposing (Html, button, div, text)
-import Html.App as Html
import Html.Events exposing (onClick)
View
@@ -1,5 +1,4 @@
import Html exposing (Html, Attribute, div, input, text)
-import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
import String
View
@@ -1,5 +1,4 @@
import Html exposing (..)
-import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing (onInput)
@@ -58,9 +57,9 @@ update msg model =
view : Model -> Html Msg
view model =
div []
- [ input [ type' "text", placeholder "Name", onInput Name ] []
- , input [ type' "password", placeholder "Password", onInput Password ] []
- , input [ type' "password", placeholder "Re-enter Password", onInput PasswordAgain ] []
+ [ input [ type_ "text", placeholder "Name", onInput Name ] []
+ , input [ type_ "password", placeholder "Password", onInput Password ] []
+ , input [ type_ "password", placeholder "Re-enter Password", onInput PasswordAgain ] []
, viewValidation model
]
View
@@ -1,5 +1,4 @@
import Html exposing (..)
-import Html.App as Html
import Html.Events exposing (..)
import Random
View
@@ -1,10 +1,8 @@
import Html exposing (..)
-import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import Http
-import Json.Decode as Json
-import Task
+import Json.Decode as Decode
@@ -40,8 +38,7 @@ init topic =
type Msg
= MorePlease
- | FetchSucceed String
- | FetchFail Http.Error
+ | NewGif (Result Http.Error String)
update : Msg -> Model -> (Model, Cmd Msg)
@@ -50,10 +47,10 @@ update msg model =
MorePlease ->
(model, getRandomGif model.topic)
- FetchSucceed newUrl ->
+ NewGif (Ok newUrl) ->
(Model model.topic newUrl, Cmd.none)
- FetchFail _ ->
+ NewGif (Err _) ->
(model, Cmd.none)
@@ -90,9 +87,9 @@ getRandomGif topic =
url =
"https://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=" ++ topic
in
- Task.perform FetchFail FetchSucceed (Http.get decodeGifUrl url)
+ Http.send NewGif (Http.get url decodeGifUrl)
-decodeGifUrl : Json.Decoder String
+decodeGifUrl : Decode.Decoder String
decodeGifUrl =
- Json.at ["data", "image_url"] Json.string
+ Decode.at ["data", "image_url"] Decode.string
View
@@ -1,5 +1,4 @@
import Html exposing (Html)
-import Html.App as Html
import Svg exposing (..)
import Svg.Attributes exposing (..)
import Time exposing (Time, second)
@@ -1,5 +1,4 @@
import Html exposing (..)
-import Html.App as Html
import Html.Attributes exposing (..)
import Html.Events exposing (..)
import WebSocket
@@ -1,12 +1,11 @@
import Html exposing (Html, fieldset, input, label, text)
-import Html.App as App
-import Html.Attributes exposing (style, type')
+import Html.Attributes exposing (style, type_)
import Html.Events exposing (onClick)
main =
- App.beginnerProgram { model = optOut, update = update, view = view }
+ Html.beginnerProgram { model = optOut, update = update, view = view }
@@ -66,6 +65,6 @@ checkbox msg name =
label
[ style [("padding", "20px")]
]
- [ input [ type' "checkbox", onClick msg ] []
+ [ input [ type_ "checkbox", onClick msg ] []
, text name
]
View
@@ -1,13 +1,12 @@
import Html exposing (Html, Attribute, div, fieldset, input, label, text)
-import Html.App as App
-import Html.Attributes exposing (name, style, type')
+import Html.Attributes exposing (name, style, type_)
import Html.Events exposing (onClick)
import Markdown
main =
- App.beginnerProgram { model = chapter1, update = update, view = view }
+ Html.beginnerProgram { model = chapter1, update = update, view = view }
@@ -84,7 +83,7 @@ radio value msg =
label
[ style [("padding", "20px")]
]
- [ input [ type' "radio", name "font-size", onClick msg ] []
+ [ input [ type_ "radio", name "font-size", onClick msg ] []
, text value
]

0 comments on commit 1d6a46c

Please sign in to comment.