Hi everyone,
I just had this idea which I think would be awesome to have.
Basically I'd like to have this:
Debug.todo : a
Debug.todo =
Debug.crash "TODO"
Which would be very simple to implement myself, but my idea would need some
additional compiler support.
This could be used to *fill a gap* in your code during prototyping, before
actually implementing anything.
Then the compiler should *generate a warning* wherever you've used it,
telling you the *type* that would be needed there.
Let me give you an example:
someButton : Html Msg
someButton =
button [ onClick Debug.todo ] [ text "foo" ]
Then the compiler would give you a warning along the lines of this:
* Missing value** on line xx
// *or: missing implementation
* button [ onClick Debug.todo ] [ text "foo" ]*
* ^^^^^^^*
* This needs to be replaced with a value** of type:
// *or: needs to be replaced with a function of type
* Msg*
Couple that with a good text editor like atom which displays warnings
inline and you immediately see what you need to provide to fill the gaps.
We could even go a step further and have:
_ = Debug.todo
This might be a bit confusing, as _ already serves as a catch all pattern,
but it isn't used as a value yet, so it would be free.
*TL;DR*
Fill gaps in your code with *Debug.todo* and the compiler tells you what
needs to go there.
*What do you think?*
I'm already using *Debug.crash* quite often for that purpose, but a
designated compiler supported solution would be ideal.
--
You received this message because you are subscribed to the Google Groups "Elm
Discuss" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.