I think you want to do something like:

 { model | -- update the record properties -- }
|> update SecondThing 
|> update ThirdThing 
|> update FourthThing

On Friday, 2 December 2016 17:56:37 UTC+1, Rex van der Spuy wrote:

Hi Everyone,
>
> Usually when I want a series of updates to chain in sequence, I'll write 
> some code like this:
>
> FirstThing ->
>   let 
>     newModel = { model | -- update the record properties -- }
>   in
>     update SecondThing newModel
>
> SecondThing ->
>   let 
>     newModel = { model | -- update the record properties -- }
>   in
>     update ThirdThing newModel
>
> ThirdThing ->
>   let 
>     newModel = { model | -- update the record properties -- }
>   in
>     update LastThing newModel
>
> LastThing ->
>   let 
>     newModel = { model | -- update the record properties -- }
>   in
>     newModel ! [ ]
>
>
> But... isn't this similar to using a GOTO statement in BASIC?
> (Hey, I love BASIC, but... !)
> I've found that when I have a few of these chained in sequence, spaghetti 
> code is the guaranteed result.
>
> Is there someway to manage this sequencing in some kind of centralized way?
> For example, something like:
>
> SequenceOfSteps ->
>   FirstThing 
>   SecondThing
>   ThirdThing
>   LastThing
>
> It would be nice to do this so that I can selectively insert or remove 
> steps while testing my application.
>
> Is this possible?
> Any advice or opinions?
>
> ​

-- 
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