D
Size: a a a
D
MP
AP
AP
Debug
MP
GotGif (Result Http.Error String)
Result Error String
, что подходит для первого аргумента в expectJson (назовем [1])Decoder a
назовем его [2]([1] -> msg) -> [2] -> Expect msg
MP
AP
AP
AP
AP
MP
MP
import Http
import Json.Decode exposing (Decoder, field, string)
type Msg
= GotGif (Result Http.Error String)
getRandomCatGif : Cmd Msg
getRandomCatGif =
Http.get
{ url = "https://api.giphy.com/v1/gifs/random?api_key=dc6zaTOxFJmzC&tag=cat"
, expect = Http.expectJson GotGif gifDecoder
}
gifDecoder : Decoder String
gifDecoder =
field "data" (field "image_url" string)
AP
AP
S
S
MP
MP
GotGif (Result Http.Error String)
и есть (Result Error a -> msg)
, а не просто (Result Error a)
?S
S