I have only recently begun immersing myself in Elm and have run into this quite early.
Here's what I want to do and it seems very reasonable: type alias Model = { signup : Signup } type alias Signup = { email : { text : String, errors : String } , password : { text : String, errors : String } } Update … ValidateSignup -> let ( emailErrors, passwordErrors ) = getSignupErrors model in ( { model | signup.email.errors = emailErrors, signup.password.errors = passwordErrors }, Cmd.none) Here's the best I've been able to come up with type alias Model = { signup : Signup } type alias Signup = { email : ValidatableString , password : ValidatableString } type alias ValidatableString = { text : String, errors : String } Update ... ValidateSignup -> let ( emailErrors, passwordErrors ) = getSignupErrors model emailUpdate = ValidatableString model.signup.email.text emailErrors passwordUpdate = ValidatableString model.signup.password.text passwordErrors signupUpdate = Signup emailUpdate passwordUpdate in ( { model | signup = signupUpdate } , Cmd.none) Please tell me I'm just missing something at this point, or advice for best practice would be very welcome. On Friday, 3 March 2017 19:12:39 UTC+13, Richard Feldman wrote: > > There have been various discussions of potential ways to improve Elm's > record update syntax. Evan commented that "(examples > design work) at this > point" - any potential designs for syntax improvements would need to be run > through a gauntlet of examples to see how well they'd work, so the first > step in the process is to gather those examples. > > So let's collect a ton of different real-world examples! That will help > guide the design process. > > If you've run into a record update that you felt was painful and could be > improved in some way, please post it here! (Also, *please keep this > thread for posting of examples* *only* - it'll be easier to link back > here during design discussions if we can reference a clean thread of > examples, as opposed to a mismash of examples interleaved with suggestions.) > -- You received this message because you are subscribed to the Google Groups "Elm Discuss" group. To unsubscribe from this group and stop receiving emails from it, send an email to elm-discuss+unsubscr...@googlegroups.com. For more options, visit https://groups.google.com/d/optout.