aboutsummaryrefslogtreecommitdiff
path: root/src/client/elm/Utils/Cmd.elm
blob: 1eee6f3d8179fc40703a050c9cbf3501c3e6be01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
module Utils.Cmd exposing
  ( pipeUpdate
  , (:>)
  )

import Platform.Cmd as Cmd

pipeUpdate : (model, Cmd msg) -> (model -> (model, Cmd msg)) -> (model, Cmd msg)
pipeUpdate (model, cmd) f =
  let
    (model', cmd') = f model
  in
  (model', Cmd.batch [ cmd, cmd' ])

(:>) : (m, Cmd a) -> (m -> (m, Cmd a)) -> (m, Cmd a)
(:>) = pipeUpdate

infixl 0 :>