This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
We were not able to find the expected elm-package.json file at this tag.
Tag 3.1.0
Committed At 2018-08-24 19:51:19 UTC

Modules

    README

    Elm Response

    Response utilities in Elm Architecture. Like, build responses from tasks, pipe them, map over.

    Usage

    What's in a response?

    type alias Response model action = ( model, Cmd action )
    

    This package offers alternate ways to construct and transform responses:

    • res and taskRes for inline constructs
    • withCmd, withCmds, withTask and withNone for piped (|>) constructs
    • mapModel, mapCmd and mapBoth for transformations
    • andThen for sequencing multiple updates

    Typical usage examples in update function:

    update : Action -> Model -> Response Model Action
    update action model =
        case action of
        
            Foo bar baz ->
                -- ( { model | someLongFieldName = foo }, Task.perform handleResult (someTaskBuilder baz) )
                res 
                    { model | someLongFieldName = foo }
                    (Task.attempt handleResult (someTaskBuilder baz))
                    
    
            Taz ->
                -- ( {model | taz = True}, Cmd.none )
                { model | taz = True }
                    |> withNone
    
            SubAction subAction ->
                -- let 
                --     ( newSub, newSubCmd ) =
                --         subActionUpdate subAction model.sub
                -- in 
                --     ( { model | sub = newSub }, Cmd.map SubAction newSubCmd )
                subActionUpdate subAction model.sub
                    |> mapBoth (\sub -> { model | sub = sub }) SubAction