From 0d31433b96e1f7e656243a44eaed97b01f8f7d80 Mon Sep 17 00:00:00 2001 From: Danila Fedorin Date: Fri, 25 May 2018 13:44:32 -0700 Subject: [PATCH] Rename method, and change debug string on top. --- Go.elm | 6 +++--- Go/Decoders.elm | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Go.elm b/Go.elm index a3a45a4..14587dd 100644 --- a/Go.elm +++ b/Go.elm @@ -1,6 +1,6 @@ import Go.Types exposing (..) import Go.Game exposing (verify) -import Go.Decoders exposing (decodeUpdatestring) +import Go.Decoders exposing (decodeUpdateString) import Go.Ws exposing (..) import Go.View exposing (..) import WebSocket @@ -28,7 +28,7 @@ initDummy = (Model view : Model -> Html Msg view m = div [] - [ text (toString m.currentColor) + [ text (toString m.board) , renderBoard m.sessionSize m.board ] @@ -37,7 +37,7 @@ update msg model = case msg of Place indx -> case verify (indx, model.sessionColor) model of Nothing -> ( { model | error = Just "Can't place piece" }, Cmd.none) Just c -> ( { model | board = c::model.board }, sendMove model c) - Update s -> case decodeUpdatestring s of + Update s -> case decodeUpdateString s of Ok (c, xs) -> ( { model | board = xs, currentColor = Just c }, Cmd.none) Err s -> ( { model | error = Just "Can't parse server response" }, Cmd.none) DismissError -> ({ model | error = Nothing }, Cmd.none) diff --git a/Go/Decoders.elm b/Go/Decoders.elm index 30d045e..3fa4a47 100644 --- a/Go/Decoders.elm +++ b/Go/Decoders.elm @@ -30,5 +30,5 @@ decodeUpdate = decode pair |> required "turn" decodeColor |> required "board" (Decode.list decodeCell) -decodeUpdatestring : String -> Result String Update -decodeUpdatestring = Decode.decodeString decodeUpdate +decodeUpdateString : String -> Result String Update +decodeUpdateString = Decode.decodeString decodeUpdate