I have learned that point-free style is preferred in the Haskell community, and I often write expressions like this:
naive = (slugifyUnicode . T.take maxFilenameSize . T.pack . stripHtmlTags . T.unpack . plainToHtml) sfld
However, while debugging, I find myself repeatedly converting expressions like this into chains of $ operators in order to use some variant of trace, and I am starting to think it is preferable to forgo the point-free style and just write lots of $s to start with, in order to make debugging less cumbersome. After all, it ends up being about the same number of characters.
Does anyone know of a way to debug long chains of composed functions without de-composing them?
And more generally, any comments on this inconvenience are very welcome.
For any intermediate value that has a
Showinstance you can just usetraceShowIdinline:If the intermediary value is a
Stringyou can usetraceIdinstead.For anything that doesn't have a
Showinstance you'd have to define a helper: