Update part5 and part6

This commit is contained in:
Richard Feldman
2016-04-02 10:07:14 -07:00
parent 69a015c304
commit fa7dc4ca91
4 changed files with 17 additions and 13 deletions

View File

@@ -9,6 +9,7 @@ import Http
import Task exposing (Task) import Task exposing (Task)
import Effects exposing (Effects) import Effects exposing (Effects)
import Json.Decode exposing (Decoder, (:=)) import Json.Decode exposing (Decoder, (:=))
import Json.Decode.Pipeline exposing (..)
import Json.Encode import Json.Encode
import Signal exposing (Address) import Signal exposing (Address)
@@ -54,12 +55,12 @@ responseDecoder =
searchResultDecoder : Decoder SearchResult searchResultDecoder : Decoder SearchResult
searchResultDecoder = searchResultDecoder =
Json.Decode.object3 -- See https://developer.github.com/v3/search/#example
SearchResult -- TODO replace these `hardcoded` with calls to `require`
-- See https://developer.github.com/v3/search/#example decode SearchResult
("TODO what field goes here?" := Json.Decode.int) |> hardcoded 0
("TODO what field goes here?" := Json.Decode.string) |> hardcoded ""
("TODO what field goes here?" := Json.Decode.int) |> hardcoded 0
performAction : (a -> b) -> (y -> b) -> Task y a -> Task x b performAction : (a -> b) -> (y -> b) -> Task y a -> Task x b

View File

@@ -8,6 +8,7 @@
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0",
"elm-lang/core": "3.0.0 <= v < 4.0.0", "elm-lang/core": "3.0.0 <= v < 4.0.0",
"evancz/elm-effects": "2.0.0 <= v < 3.0.0", "evancz/elm-effects": "2.0.0 <= v < 3.0.0",
"evancz/elm-html": "4.0.0 <= v < 5.0.0", "evancz/elm-html": "4.0.0 <= v < 5.0.0",

View File

@@ -2,12 +2,13 @@ module ElmHub (..) where
import Auth import Auth
import Html exposing (..) import Html exposing (..)
import Html.Attributes exposing (..) import Html.Attributes exposing (class, target, href, property)
import Html.Events exposing (..) import Html.Events exposing (..)
import Http import Http
import Task exposing (Task) import Task exposing (Task)
import Effects exposing (Effects) import Effects exposing (Effects)
import Json.Decode exposing (Decoder, (:=)) import Json.Decode exposing (Decoder, (:=))
import Json.Decode.Pipeline exposing (..)
import Json.Encode import Json.Encode
import Signal exposing (Address) import Signal exposing (Address)
@@ -37,11 +38,10 @@ responseDecoder =
searchResultDecoder : Decoder SearchResult searchResultDecoder : Decoder SearchResult
searchResultDecoder = searchResultDecoder =
Json.Decode.object3 decode SearchResult
SearchResult |> required "id" Json.Decode.int
("id" := Json.Decode.int) |> required "full_name" Json.Decode.string
("full_name" := Json.Decode.string) |> required "stargazers_count" Json.Decode.int
("stargazers_count" := Json.Decode.int)
type alias Model = type alias Model =

View File

@@ -4,10 +4,12 @@
"repository": "https://github.com/rtfeldman/elm-workshop.git", "repository": "https://github.com/rtfeldman/elm-workshop.git",
"license": "BSD-3-Clause", "license": "BSD-3-Clause",
"source-directories": [ "source-directories": [
".", ".." ".",
".."
], ],
"exposed-modules": [], "exposed-modules": [],
"dependencies": { "dependencies": {
"NoRedInk/elm-decode-pipeline": "1.0.0 <= v < 2.0.0",
"elm-lang/core": "3.0.0 <= v < 4.0.0", "elm-lang/core": "3.0.0 <= v < 4.0.0",
"evancz/elm-effects": "2.0.0 <= v < 3.0.0", "evancz/elm-effects": "2.0.0 <= v < 3.0.0",
"evancz/elm-html": "4.0.0 <= v < 5.0.0", "evancz/elm-html": "4.0.0 <= v < 5.0.0",