# Seeing Commands in the time traveling debugger

**URL:** <https://discourse.elm-lang.org/t/seeing-commands-in-the-time-traveling-debugger/7745>\
**Category:** Learn\
**Created:** [September 10, 2021, 9:36pm UTC](https://discourse.elm-lang.org/t/seeing-commands-in-the-time-traveling-debugger/7745 "2021-09-10T21:36:07Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![push-f](https://avatars.discourse-cdn.com/v4/letter/p/ce73a5/32.png) [@push-f](https://discourse.elm-lang.org/u/push-f)\
**Post date:** [September 10, 2021, 9:36pm UTC](https://discourse.elm-lang.org/t/seeing-commands-in-the-time-traveling-debugger/7745/1 "2021-09-10T21:36:07Z")

</div>

Hello, I’m very new to Elm and have to say that I really like the time traveling debugger 🙂

Since my `Browser.element` app is controlled by the following function:

```auto
update : Msg -> Model -> ( Model, Cmd Msg )

```

I’d love to also see the commands in the time traveling debugger. Is that currently possible? If not how difficult would it be to implement this?

---

<div class="post-metadata">

**Author:** ![perty](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/perty/32/4459_2.png) [@perty](https://discourse.elm-lang.org/u/perty)\
**Post date:** [September 11, 2021, 9:56pm UTC](https://discourse.elm-lang.org/t/seeing-commands-in-the-time-traveling-debugger/7745/2 "2021-09-11T21:56:24Z")

</div>

Guess it would be hard. Cmd are quite opaque.

What is the problem? Perhaps there is some other way to solve it.

I can see the Msg in the debugger so I can then conclude the Cmd from that. Is that not enough?

---

<div class="post-metadata">

**Author:** ![antew](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/antew/32/2102_2.png) [@antew](https://discourse.elm-lang.org/u/antew)\
**Post date:** [September 12, 2021, 3:02am UTC](https://discourse.elm-lang.org/t/seeing-commands-in-the-time-traveling-debugger/7745/3 "2021-09-12T03:02:27Z")

</div>

It requires some code changes, but the Effect pattern ([The effects pattern - Elm Patterns](https://sporto.github.io/elm-patterns/architecture/effects.html)) allows logging the effects that are returned. It is a fairly invasive change, but it can be a boon for testing as well, and is a prerequisite for elm-program-test ([elm-program-test 3.5.0](https://package.elm-lang.org/packages/avh4/elm-program-test/latest/))

---

<div class="post-metadata">

**Author:** ![lydell](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/lydell/32/178_2.png) [@lydell](https://discourse.elm-lang.org/u/lydell)\
**Post date:** [September 12, 2021, 10:05am UTC](https://discourse.elm-lang.org/t/seeing-commands-in-the-time-traveling-debugger/7745/4 "2021-09-12T10:05:18Z")

</div>

> [@perty](#):
>
> Guess it would be hard. Cmd are quite opaque.

I would have guessed the opposite: That adding this feature to the debugger would be _easier_ since `Cmd` are opaque.

> [@perty](#):
>
> I can see the Msg in the debugger so I can then conclude the Cmd from that.

You can use `if-else` in `update` so you can never tell for sure which commands are sent.

> [@push-f](#):
>
> If not how difficult would it be to implement this?

This is a very interesting question! I’ve never thought about it before, but it does sound useful to see not just see the resulting model after each message, but also the resulting commands! I’ve added `Debug.log` at commands before to see if they get triggered or not, so just getting that directly from the debugger does sound time saving. Similarly, it might be useful to see which subscriptions we have after each message, too!

It would guess this requires going through the Kernel (JS) code for all `elm/*` packages and attach some kind of debugging information to the commands that they can produce, and probably only when the debugger is enabled (the compiler has support for switching between different JS code for dev/prod using comments).

Then one would need to update the [browser/src/Debugger at master · elm/browser · GitHub](https://github.com/elm/browser/tree/master/src/Debugger) code to display commands (and subscriptions), as needed (for example, not for `Browser.sandbox`).

I have dug around a bit in the Debugger source code before, so it does _sound_ possible but it’d take an answer from someone who has actually worked on it to get a more precise answer.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex035/uploads/elm_lang/original/1X/50a05e53677a2c3b47776d7abd0f113eb50193a1.png) [@system](https://discourse.elm-lang.org/u/system)\
**Post date:** [September 22, 2021, 10:05am UTC](https://discourse.elm-lang.org/t/seeing-commands-in-the-time-traveling-debugger/7745/5 "2021-09-22T10:05:38Z")

</div>

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.
