I don’t know if something like this already exists, but I found it helpful:
probeAs label x = Tuple.first ( x, Debug.log label (Debug.toString x) ) probe x = (probeAs "<<PROBE>>" x)
This lets you log an expression without having to break that expression out into some separate named thing.
probeAs creates a tuple in which the second argument is the call to the log function. Assuming Elm doesn’t optimize it out (it doesn’t appear to), then that should produce the output in the browser console. Only the first element is returned, which is the input.
probe is a one-argument specialization that doesn’t even make you provide a label, if you just want to do something very quickly.
Is there a better way to say
Tuple.first (x, f x) … in particular one that is guaranteed not to optimize out
f x ?