[Haskell-beginners] Indenting

John Moore john.moore54 at gmail.com
Fri Dec 4 15:26:52 EST 2009

     I'm a bit stuck. I want to indent my answer by using a count function
to indent my answer. Say for example I want to show the levels in a simple
arithmethic expression.
like 3*(4+5)
I want to be able to print out :
 4+5 = 9
    3*9 = 27 (notice the indentation as I go through an expression.

I tried this but it a mess, I tried to use prettyprint but this seemed very

Any suggestions greatly appreciated

type Indent = (Int)
spacing :: Int -> Indent
spacing n = Nothing
spacing n (x:xs) = if (n==1)
                    then (Just n)
                   else spacing n xs
                    where (n > 1)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.haskell.org/pipermail/beginners/attachments/20091204/433a6e49/attachment-0001.html

More information about the Beginners mailing list