Closed mrapacz closed 6 years ago
Very nice idea, Im all for it. I would give it a little more descriptive name because its unpacking only decoders-like updates (right?).
@pmrukot Exactly, the flow is use the decoder and then run the function over extracted value
. Do you have any suggestions on better naming?
Maybe decodeAndUpdate
? I guess we should store this thing in the Update.elm
anyway as that's what it does in the end.
Works for me
Type
Enhancement
Current behaviour We could DRY out our code easily. Right now we are following this pattern:
or
Expected behaviour We could get rid of this pattern matching on the result and introduce a function that would handle this stuff for us. It would work like this:
the final usage would look like the following:
instead of the current version:
The anonymous function of course could be an actual function. We could pass something like
updateUserListMessage
here and store the actual implementation in a separate file (thus making our Update shorter!)Motivation / use case DRYing out the code
@pmrukot @jtkpiotr I'm waiting for your opinions on that. If I get a blessing on that I can replace the unpacking and post a PR with that.