Plurrrr

Tue 29 Mar 2022

Pure Print-Style Debugging in Haskell

For developers working in impure languages, print debugging is often the first stop for figuring out where and why something is going wrong. In Haskell, where printing something to the screen is a side effect to avoid, it might seem like you need to give up print debugging for the sake of purity. Thankfully, you can have your cake and eat it too… if you're okay with eating buggy cake.

The Debug.Trace module, which is part of base, provides tools for print-style debugging for our pure functional programs. In this article, we’ll walk through a hands-on example using print-style debugging to narrow down the problem with a small example program. You’ll learn how to apply tracing to finding bugs in a Haskell program, and you’ll learn a little bit about Unicode along the way.

Source: Pure Print-Style Debugging in Haskell, an article by Rebecca Skinner.

Monads

A monad is a common abstraction. While typically associated with Haskell, monads also exist in C# and other languages.

Source: Monads, an article by Mark Seemann.