aboutsummaryrefslogtreecommitdiff
path: root/src/client/Utils/Cmd.elm
blob: 5f41cbeb759500657449eb2ea147904916c93276 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
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 (newModel, newCmd) = f model
  in  (newModel, Cmd.batch [ cmd, newCmd ])

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

infixl 0 :>