Hi Everyone,

Is it possible to pass model properties as message arguments and use those 
arguments to construct a new model?

For example, the only difference between these two messages is the model's 
properties:

    AnimateQuestion animMsg ->
      let 
        (newStyle, cmds) = 
          Animation.Messenger.update
            animMsg
            model.questionTextStyle
      in
     ({ model
         | questionTextStyle = newStyle
     }
     , cmds 
     )

    AnimateAnswer animMsg ->
      let 
        (newStyle, cmds) = 
          Animation.Messenger.update
            animMsg
            model.answerTextStyle
      in
     ({ model
         | answerTextStyle = newStyle
     }
     ,

Is it somehow possible to combine these into one message, using a generic 
"property" placeholder that could be provided by the argument?:

 Animate animMsg property ->
      let 
        (newStyle, cmds) = 
          Animation.Messenger.update
            animMsg
            model.property
      in
     ({ model
         | property = newStyle
     }

That doesn't work of course, but is there some way to make it work?

Thanks!! 

-- 
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 [email protected].
For more options, visit https://groups.google.com/d/optout.

Reply via email to