This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
1.0.0 1.0.1

Effects.Extra

Convenience functions for working with effects in Elm

pipeUpdate : (m, Effects a) -> (m -> (m, Effects a)) -> (m, Effects a)

A function allowing you to compose calls to update. Most useful when used in its infix form to make an update pipeline.

import Effects.Extra.Infix exposing ((:>))

update : Action -> Model -> (Model, Effects Action)
update action model =
  ComposedAction ->
    (model, Effects.none)
      :> update AnotherAction
      :> update YetAnotherAction
      :> update SubComponent.SomeAction
module Effects.Extra where

{-| Convenience functions for working with effects in Elm

@docs pipeUpdate
-}

import Effects exposing (Effects)

{-| A function allowing you to compose calls to update.  Most useful when used
in its infix form to make an update pipeline.

    import Effects.Extra.Infix exposing ((:>))

    update : Action -> Model -> (Model, Effects Action)
    update action model =
      ComposedAction ->
        (model, Effects.none)
          :> update AnotherAction
          :> update YetAnotherAction
          :> update SubComponent.SomeAction

-}
pipeUpdate : (m, Effects a) -> (m -> (m, Effects a)) -> (m, Effects a)
pipeUpdate (model, effects) f =
  let
    (model', effects') = f model
  in
  (model', Effects.batch [ effects', effects ])