3 ms·
Interesting, maybe I'm just less familiar with debugging in Haskell.
by king_magic 11y ago
Interesting, maybe I'm just less familiar with debugging in Haskell.
- mbrock 11y agoThis is kind of a special scenario since what's described in the pipeline is already an I/O action, which makes it easy to insert logging anywhere (e.g., a "tap" component that prints its input and output w/ timestamp). Such pipelines aren't necessarily made up of I/O actions though; they can also be pure computations, which cannot perform side-effects such as logging. In that case, you can still insert debugging helpers, but you might need to be slightly creative. For example, if your pipeline generates a list of values, you could put debugging entries into that list. Generally, though, the saving grace in such a case is that each component will be a pure transformation, which means that you can easily call it with a test input and inspect the output. There are some step-by-step debugging tools for Haskell, but I haven't used them, and Haskell programmers mostly seem uninterested in that way of debugging. It doesn't fit very well with Haskell's evaluation model anyway. When I work with Haskell, I just debug in a different way, focusing on verifying correctness of functions and their combinations.
- codygman 11y ago> There are some step-by-step debugging tools for Haskell, but I haven't used them, and Haskell programmers mostly seem uninterested in that way of debugging. It doesn't fit very well with Haskell's evaluation model anyway. When I work with Haskell, I just debug in a different way, focusing on verifying correctness of functions and their combinations. I created hs-scrape[0] to write web scrapers and I frequently use the ghci debugger[1] for step-by-step debugging. 0: https://github.com/codygman/hs-scrape/ https://github.com/codygman/hs-scrape/ 1: https://downloads.haskell.org/~ghc/latest/docs/html/users_guide/ghci-debugger.html https://downloads.haskell.org/~ghc/latest/docs/html/users_gu...