# How Do You Inspect Intermediate Results In The View?

**URL:** <https://discourse.elm-lang.org/t/how-do-you-inspect-intermediate-results-in-the-view/1242>\
**Category:** Learn\
**Created:** [May 8, 2018, 9:09am UTC](https://discourse.elm-lang.org/t/how-do-you-inspect-intermediate-results-in-the-view/1242 "2018-05-08T09:09:30Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Viir](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/viir/32/4103_2.png) [@Viir](https://discourse.elm-lang.org/u/Viir)\
**Post date:** [May 8, 2018, 9:09am UTC](https://discourse.elm-lang.org/t/how-do-you-inspect-intermediate-results-in-the-view/1242/1 "2018-05-08T09:09:30Z")

</div>

I am working on an elm app and the view function grows larger and more complex.  
When running the app, I see a result on my screen which looks wrong. How did it end up this way?  
With the inspector tool in elm 0.18, I can inspect the `model` and make sure that it matches my expectation, so I can rule out a problem in that part.  
A bug must be somewhere in the view. Given the particular frame/update of the app, I would like to take a closer look what happens in the view.

How can I see the intermediate values in the call tree in the view?  
Having a visualization of the expression tree with the ability to expand and collapse branches (like the tree of the `model` in the 0.18 inspector) would already be a big improvement over the tools I am aware of at the moment.

I guess there are better ways than the ones I have discovered so far, so I would like to learn how you do this inspection.

---

<div class="post-metadata">

**Author:** ![gampleman](https://yyz1.discourse-cdn.com/flex035/user_avatar/discourse.elm-lang.org/gampleman/32/43_2.png) [@gampleman](https://discourse.elm-lang.org/u/gampleman)\
**Post date:** [May 8, 2018, 9:14am UTC](https://discourse.elm-lang.org/t/how-do-you-inspect-intermediate-results-in-the-view/1242/2 "2018-05-08T09:14:01Z")

</div>

Unfortunately, `Debug.log` seems to be your friend here.

One trick that might help is that you can use the `_` dummy variable to add multiple logging statements.

```auto
view model =
  let
    _ = Debug.log "foo" model.foo
    _ = Debug.log "bar" model.bar
  in
   ...

```

The only gotcha with this is that the compiler can (and sometimes does) reorder the definitions within the let block, so you can see the messages in an unexpected order in your console.

---

<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:** [May 18, 2018, 9:18am UTC](https://discourse.elm-lang.org/t/how-do-you-inspect-intermediate-results-in-the-view/1242/3 "2018-05-18T09:18:42Z")

</div>

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