This is an alternative site for discovering Elm packages. You may be looking for the official Elm package site instead.
A straightforward alternative to (!)
version 1.0.0
license BSD-3-Clause
native-modules False
elm-version 0.18.0 <= v < 0.19.0
Tag 1.0.0
Committed At 2017-01-22 12:54:11 UTC
elm-lang/core 5.0.0 <= v < 6.0.0 5.1.1

Modules

README

rocket-update 🚀

This package provides a simpler alternative to the (!) operator.

Tuple Rocketry

The "rocket operator" (=>) does nothing more than return a tuple:

("display" => "none") == ( "display", "none" )

Style Rocketry

It looks kinda nice to use this for things like styles:

button [ style [ "display" => "none" ] ] [ text "invisible!" ]

instead of

button [ style [ ( "display", "none" ) ] ] [ text "invisible!" ]

Update Rocketry

If you tweak update to return ( model, List (Cmd msg) ), then you can use (=>) to serve the same purpose as (!), like so:

update : Msg -> Model -> ( Model, List (Cmd Msg) )
update msg model =
    case msg of
        Reset ->
            { model | stuff = newStuff } => []

        SendRequest ->
            model => [ Http.send someRequest ]

        SendOtherRequest ->
            model
                |> doSomethingToModel
                |> doSomethingElseToModel
                => [ Http.send someOtherRequest ]

To get an update function of this type, just use the Rocket.batchUpdate function when calling program and you're all set. (There's a batchInit function for init too, so update and init can be consistent.)

main : Program Never Model Msg
main =
    Html.program
        { init = init >> Rocket.batchInit
        , update = update >> Rocket.batchUpdate
        , view = view
        , subscriptions = subscriptions
        }

That's it!

In the example/ folder you can find elm-todomvc revised to use this style.

Enjoy! 🚀