
14 Apr
2008
14 Apr
'08
3:30 a.m.
Hi
On Mon, Apr 14, 2008 at 8:22 AM, Benjamin L. Russell
A friend and I were working on a Haskell version of Towers of Hanoi yesterday, and I tried writing out the program today, but got stuck on outputting newlines as part of the string; viz:
| n == 1 = putStrLn ("Move " ++ show source ++ " to " ++ show dest ++ "." ++ show '\n')
show '\n' = "\\n" "\n" == "\n" Therefore:
| n == 1 = putStrLn ("Move " ++ show source ++ " to " ++ show dest ++ "." ++ "\n")
Note that you need the brackets, an in general don't call show on a String or a Char. Thanks Neil