colin353 / mushu-new

0 stars 1 forks source link

Refactor #75

Closed iteloo closed 6 years ago

iteloo commented 6 years ago

It's probably easier to understand if you review each commit individually. Some changes are just renaming:

type alias Eff a = (a, Cmd Msg)
type alias Upd a = a -> (a, Cmd Msg)
model ! [ cmd ] = (model, cmd)

And I combined the toServer and toMsg information passed down from the parent update functions into one Ctx type (I needed a second GameCtx type because of the way things are set up on the server now with auto-joining games).

The Lens in the first commit is a little harder to understand. I abstracted over the getter and setters so I can handle the errors uniformly.