elm-hedley icon indicating copy to clipboard operation
elm-hedley copied to clipboard

Use elm-response to remove code duplication in App.Update

Open amitaibu opened this issue 8 years ago • 2 comments

Looking at the example in the package:

SubAction subAction ->
      -- let (newSub, newSubEffects) = subActionUpdate subAction model.sub
      -- in (\sub -> { model | sub = newSub }) (Effects.map SubAction newSubEffects)
      subActionUpdate subAction model.sub
        |> mapBoth (\sub -> { model | sub = sub }) SubAction

this could save some code duplication in App.Update and in general be a nice addition :)

(cc @etaque)

amitaibu avatar Mar 30 '16 18:03 amitaibu

Oh, actually it seems that we always pass a different context to sub components or re-build the effects

Maybe we could use it on simpler sub-components. If not, then we'll sure use it in other projects ;)

amitaibu avatar Mar 30 '16 18:03 amitaibu

:+1:

etaque avatar Mar 30 '16 19:03 etaque