Concept → IO ()

Linux Emacs Coding Music Links About Search

Easy pretty print in Haskell

I repeatedly struggle with GHCi when I want to print lists and maps and actually look at them and analyze them. Today I came accross pretty-show, a haskell package that allows pretty printing of all objects that are instances of the type class Show.

The usage is very straight forward:

import qualified Text.Show.Pretty as Pr

This provides Pr.ppShow which can be used in GHCi (or other interpreters):

putStrLn $ Pr.ppShow object