rainteller
Feb 24, 2017 · 1 min read

In certain cases it makes sense to do something like this:

case msg of
Rated newRating ->
let
movie = model.currentMovie
in
{ model | currentMovie = Movie model.title model.director newRating}

I’ve found this pattern useful in cases like updating the entire record, e.g.:

type alias User = { name : String, isLoggedIn : Bool }case msg of
UpdateCurrentUser newUser ->
{ model | user = User newUser.name True }

Still not ideal, but I found it to help me reduce some code in the app I’m currently working on :-)

    rainteller

    Written by