How to debug algorithms in elm

Hi friends,

I’m enjoying learning elm, but have hit a block as I try to implement an algorithm using elm.
I’m trying to do the binary search algorithm, and have got a program that doesn’t have any compilation/run errors, but isn’t giving the correct results.

Does anyone know what is the best way to debug this kind of situation in elm.

Is there a step debugger to step through the running of the code? That’s what I would default to in JS or PHP and it gets me to the source of mistakes quickest I find.

Any help much appreciated :slight_smile:
thanks

Did you find Debug? If so, in what ways does it fall short?

2 Likes

There isn’t any step-by-step debugger for elm programs. There is something similar for that goes from one update to the next when debugging web apps, but it’s in a different context than what we have for exercism.

As suggested @MatthijsBlom though you can use Debug.log to help you by displaying different values in your output stream. Example in screenshot.

1 Like

Aw, thanks guys.

I was hoping it would have a step debugger as I find I can more quickly get to the root of issues when I can see exactly what it is doing.

I’ll use the “console.log” equivalent strategy for now.

Thanks for your help guys

This podcast has some recent thoughts about debugging

As others has said though, Debug.log is the best bet for debugging within Exercism.