Elm Language Debugging

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Syntax

  • Debug.log "tag" anyValue

Remarks

Debug.log takes two parameters, a String to tag the debug output in the console (so you know where it's coming from / what the message corresponds to), and a value of any type. Debug.log executes the side-effect of logging the tag and the value to the JavaScript console, and then returns the value. The implementation in JS might look something like:

function log (tag, value){
    console.log(tag, value);
    return value
}

JavaScript has implicit conversions, so value doesn't have to be explicitly converted to a String for the above code to work. However, Elm types must be explicitly converted to a String, and the Native code for Debug.log shows this in action.



Got any Elm Language Question?