Rename method, and change debug string on top.

This commit is contained in:
Danila Fedorin 2018-05-25 13:44:32 -07:00
parent b0c9c5ec18
commit 0d31433b96
2 changed files with 5 additions and 5 deletions

6
Go.elm
View File

@ -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)

View File

@ -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