docspell/modules/webapp/src/main/elm/Util/Update.elm
2019-12-29 21:55:12 +01:00

19 lines
408 B
Elm

module Util.Update exposing (andThen1)
andThen1 : List (a -> ( a, Cmd b )) -> a -> ( a, Cmd b )
andThen1 fs a =
let
init =
( a, [] )
update el tuple =
let
( a2, c2 ) =
el (Tuple.first tuple)
in
( a2, c2 :: Tuple.second tuple )
in
List.foldl update init fs
|> Tuple.mapSecond Cmd.batch