|
|
Hi
On Mon, Apr 14, 2008 at 8:22 AM, Benjamin L. Russell
<dekudekuplex@xxxxxxxxx> wrote:
> 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
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@xxxxxxxxxxx
http://www.haskell.org/mailman/listinfo/haskell-cafe
|
|