1 2 3 4 5 6 7 8 9 10 11 12 13 14
module Pretty where import Data.List class Pretty a where pretty :: a -> String pretty = prettyI 0 prettyI :: Int -> a -> String instance Pretty a => Pretty [a] where prettyI i l = "[" ++ intercalate ", " (map (prettyI i) l) ++ "]"