This is inspired by Gleam: whenever you use their equivalent of Debug.todo, it tells you where the call was and what type it is expecting, which is quite nice:
Elm instead doesn't mention the specific calls to Debug.todo at all (nor their types):
-- DEBUG REMNANTS --------------------------------------------------------------
There are uses of the `Debug` module in the following modules:
Main
But the --optimize flag only works if all `Debug` functions are removed!
Note: The issue is that --optimize strips out info needed by `Debug` functions.
Here are two examples:
(1) It shortens record field names. This makes the generated JavaScript is
smaller, but `Debug.toString` cannot know the real field names anymore.
(2) Values like `type Height = Height Float` are unboxed. This reduces
allocation, but it also means that `Debug.toString` cannot tell if it is
looking at a `Height` or `Float` value.
There are a few other cases like that, and it will be much worse once we start
inlining code. That optimization could move `Debug.log` and `Debug.todo` calls,
resulting in unpredictable behavior. I hope that clarifies why this restriction
exists!
This is inspired by Gleam: whenever you use their equivalent of
Debug.todo
, it tells you where the call was and what type it is expecting, which is quite nice:Elm instead doesn't mention the specific calls to
Debug.todo
at all (nor their types):