Chris Stryczynski

Software Developer / Consultant

Tips for debugging Haskell code

Posted on: 16/03/2018

Debugging Haskell code can be so painfull sometimes.

Console logging…

If you’re tracing / printing out debug lines, due to the lazy nature everything seems to occur out of order… You can enable these two pragmas to force it to be more strict:

{-# LANGUAGE Strict #-}
{-# LANGUAGE StrictData #-}

Purity hassles

import System.IO.Unsafe
  () <- return $ unsafePerformIO $! do
    print "?????????????"
    print x
    print x'

Improved formatting

import Text.Pretty.Simple (pPrint)

No comments, yet!

Submit a comment