Skip to content

Improve debug information for complex types #641

@farism

Description

@farism

It would be nice to preserve some of the debug information for complex types so that Debug.log would be more useful. This would only take effect when developing, not when doing a production (minified) bundle.

Some examples are below (generated names can be differnet)

record Point2D {
  x : Number,
  y : Number
}

component Main {
  fun foo {
    ""
  }

  fun componentDidMount {
    /*
    Prints `r {x:0, y:0}`

    It would be nice if this was `Point2D {x:0, y:0}`
    */
    Debug.log(Point2D(0, 0))

    /*
    Prints an object `AI {_0: 'hello world', length: 1}`

    It would be nice if it would print the as-is `Maybe::Just("hello world")`
    */
    Debug.log(Maybe::Just("hello world"))

    /*
    Prints `ƒ a() { return ''; }`

    It would be nice if this set the function name so it would print `ƒ foo() { return ''; }`
    */
    Debug.log(foo)
  }

  fun render : Html {
    <div/>
  }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestlanguageLanguage feature

    Type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions