{"action":"created","issue":{"url":"https://api.github.com/repos/ccapndave/elm-update-extra/issues/5","repository_url":"https://api.github.com/repos/ccapndave/elm-update-extra","labels_url":"https://api.github.com/repos/ccapndave/elm-update-extra/issues/5/labels{/name}","comments_url":"https://api.github.com/repos/ccapndave/elm-update-extra/issues/5/comments","events_url":"https://api.github.com/repos/ccapndave/elm-update-extra/issues/5/events","html_url":"https://github.com/ccapndave/elm-update-extra/pull/5","id":157934484,"number":5,"title":"More features added to enable pipelining of messages in updates","user":{"login":"besuikerd","id":1638661,"avatar_url":"https://avatars.githubusercontent.com/u/1638661?v=3","gravatar_id":"","url":"https://api.github.com/users/besuikerd","html_url":"https://github.com/besuikerd","followers_url":"https://api.github.com/users/besuikerd/followers","following_url":"https://api.github.com/users/besuikerd/following{/other_user}","gists_url":"https://api.github.com/users/besuikerd/gists{/gist_id}","starred_url":"https://api.github.com/users/besuikerd/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/besuikerd/subscriptions","organizations_url":"https://api.github.com/users/besuikerd/orgs","repos_url":"https://api.github.com/users/besuikerd/repos","events_url":"https://api.github.com/users/besuikerd/events{/privacy}","received_events_url":"https://api.github.com/users/besuikerd/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":17,"created_at":"2016-06-01T15:19:51Z","updated_at":"2016-06-06T12:52:48Z","closed_at":null,"pull_request":{"url":"https://api.github.com/repos/ccapndave/elm-update-extra/pulls/5","html_url":"https://github.com/ccapndave/elm-update-extra/pull/5","diff_url":"https://github.com/ccapndave/elm-update-extra/pull/5.diff","patch_url":"https://github.com/ccapndave/elm-update-extra/pull/5.patch"},"body":"I Was experimenting around with your module and came across a few use cases where I needed a few more functions regarding updates. These are the functions I implemented:\r\n\r\n* `andThen`\r\n* `filter`\r\n* `addCmd`\r\n* `batch`\r\n\r\nI added a [test example](https://github.com/besuikerd/elm-update-extra/blob/master/test/Counter/Main.elm) to test out these new operators.\r\n\r\nI tried to match the method names to match commonly used names in other modules. `andThen` does the same thing as `pipeUpdate`, but with its arguments flipped. This allows it to be used with the 'pipeline operator' `|>`.\r\n\r\nexample usage:\r\n```elm\r\nupdate msg model =\r\n  model ! []\r\n    |> andThen update SomeMessage\r\n    |> andThen update SomeOtherMessage\r\n    ...\r\n```\r\n\r\n`filter` is used to only send the messages if the predicate evaluates to true\r\n\r\nexample usage:\r\n```elm\r\nupdate msg model =\r\n  case msg of\r\n    SomeMessage i ->\r\n      model ! []\r\n        |> filter (i > 10)\r\n          ( \\state -> state\r\n              |> andThen update BiggerThanTen\r\n              |> andThen update AnotherMessage\r\n              |> andThen update EvenMoreMessages\r\n          )\r\n        |> andThen update AlwaysTriggeredAfterPredicate\r\n\r\n```\r\n\r\n`batch` is the operator as discussed by #2, #4. I think `batch` is a good fit considering `Cmd` and `Sub` also use them to concatenate. These are also used with `|>`:\r\n\r\n```elm\r\nupdate msg model = model ! []\r\n  |> batch update\r\n    [ AMessage\r\n    , AnotherMessage\r\n    , AThirdMessage\r\n    ]\r\n```\r\n\r\n`addCmd` is added as requested by #3.\r\n\r\nEDIT: updated `andThen` to match the signatures"},"comment":{"url":"https://api.github.com/repos/ccapndave/elm-update-extra/issues/comments/223949755","html_url":"https://github.com/ccapndave/elm-update-extra/pull/5#issuecomment-223949755","issue_url":"https://api.github.com/repos/ccapndave/elm-update-extra/issues/5","id":223949755,"user":{"login":"jvoigtlaender","id":5853832,"avatar_url":"https://avatars.githubusercontent.com/u/5853832?v=3","gravatar_id":"","url":"https://api.github.com/users/jvoigtlaender","html_url":"https://github.com/jvoigtlaender","followers_url":"https://api.github.com/users/jvoigtlaender/followers","following_url":"https://api.github.com/users/jvoigtlaender/following{/other_user}","gists_url":"https://api.github.com/users/jvoigtlaender/gists{/gist_id}","starred_url":"https://api.github.com/users/jvoigtlaender/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jvoigtlaender/subscriptions","organizations_url":"https://api.github.com/users/jvoigtlaender/orgs","repos_url":"https://api.github.com/users/jvoigtlaender/repos","events_url":"https://api.github.com/users/jvoigtlaender/events{/privacy}","received_events_url":"https://api.github.com/users/jvoigtlaender/received_events","type":"User","site_admin":false},"created_at":"2016-06-06T12:52:48Z","updated_at":"2016-06-06T12:52:48Z","body":"Maybe the `andThen` shouldn't exist. When is it more useful than the `(|>)` operator?"}}
{"actor":{"display_login":"jvoigtlaender"}}