Composing a Task with a function that returns a Cmd

A similar but slightly different approach

init : () -> ( Model, Cmd Msg )
init _ =
    ( ()
    , Time.now
        |> Task.map timeToCmd
        |> Task.perform RunCmd
    )


type Msg
    = RunCmd (Cmd Msg)
    | ...


update : Msg -> Model -> ( Model, Cmd Msg )
update msg model =
    case msg of
        RunCmd cmd ->
            ( model, cmd )
        ...