ndmitchell / debug

Haskell library for debugging
BSD 3-Clause "New" or "Revised" License
122 stars 7 forks source link

Ported the frontend to Purescript #47

Closed pepeiborra closed 6 years ago

pepeiborra commented 6 years ago

This is a straight port of debug.js to debug.purs. From there, debug.js is generated using

pulp build -m Debug -O --to ../html/debug.js

I believe that there are no functional changes other than a minor fix to the generator of the #function-source control.

In retrospect, the Javascript version was shorter and somewhat easier to understand, but I would be wary of building more features up like pagination, better displays for lambdas, call stacks, etc.

You may not want to merge this since it is my first contact with Purescript and it may be of dubious quality. I would understand if you decided to stick to Javascript for now.

TODO

pepeiborra commented 6 years ago

I don't know where to start about the TODO items, any pointers will be appreciated.

ndmitchell commented 6 years ago

Regarding the todo list, integrating it into the build system of Cabal is a disaster - you essentially tie yourself to writing a Setup.hs file in a language which is continually evolving and gives a terrible user experience. I did that once many years ago and would never do it again. A .bat and .sh file is usually a better idea, and then check in the generated code.

I agree the Purescript seems overly complex. My inclination is to say that it's a nice experiment, but that ultimately an alternative Js-like language is a better fit in this instance (lots of DOM manipulation, relatively little other stuff). As noted in the original ticket, my preference remains TypeScript. I suggest I merge this without the change to html/debug.js, then I give a go at conversion to TypeScript, and afterwards we compare and see which (if either) should replace the JS. Like you, I suspect that doing more stuff in JS is likely to be difficult in the long term.

pepeiborra commented 6 years ago

The direct DOM manipulation is too low level, not a good thing imho. I was planning to evolve towards an Elm or frp UI next.

ndmitchell commented 6 years ago

That seems quite reasonable. For now I suggest reverting debug.js back to how it was and I'll merge - then we can switch over once we have compelling benefits.

pepeiborra commented 6 years ago

That is completely sensible, thanks !

pepeiborra commented 6 years ago

I am sketching an Elm version which no longer does any DOM manipulation at all. Elm is a very good fit here, the code is pretty nice despite feeling a lot like F#.

See https://github.com/pepeiborra/debug/blob/elm/elm/Main.elm

marklnichols commented 6 years ago

That's cool -- I have been wanting to give Elm a try for a while. I'll be very interested to see what you think of it when you are done.

ndmitchell commented 6 years ago

I couldn't figure out to take the commits and remove the edits to debug.js, so I just copied them over in a fresh commit. Agreed that we don't want to go this way, but useful to keep it for the future.