error-message-catalog
error-message-catalog copied to clipboard
Dict.insert given type mismatch error when it should be given Arg count error.
These work.
{ model | gameData = Dict.insert model.game { game | players = List.Extra.unique (List.append game.players [ model.player ]) } model.gameData }
{ model | gameData = Dict.insert model.game { players = [ model.player ] } model.gameData }
But these give worry error
{ model | gameData = Dict.insert model.game { game | players = List.Extra.unique (List.append game.players [ model.player ]) } }
--ERROR
I cannot update the `gameData` field like this:
85| { model | gameData = Dict.insert model.game { game | players = List.Extra.unique (List.append game.players [ model.player ]) } }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This `insert` call produces:
Dict String { players : List String }
-> Dict String { players : List String }
But it should be:
Dict String Game
Note: The record update syntax does not allow you to change the type of fields.
You can achieve that with record constructors or the record literal syntax.
{ model | gameData = Dict.insert model.game { players = [ model.player ] } }
--ERROR
I cannot update the `gameData` field like this:
88| { model | gameData = Dict.insert model.game { players = [ model.player ] } }
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
This `insert` call produces:
Dict String { players : List String }
-> Dict String { players : List String }
But it should be:
Dict String Game
Note: The record update syntax does not allow you to change the type of fields.
You can achieve that with record constructors or the record literal syntax.
OH
type alias Game =
{ players : List String }
I found this to be confusing as well