
29 Dec
2005
29 Dec
'05
5:15 p.m.
Also, if you are trying to display a line that looks like insert 5 or consume 6 then consider using
putStrLn ("insert " ++ show r) putStrLn ("consume " ++ show r)
instead of
print ("insert " ++ show r) print ("consume " ++ show r)
to avoid printing out the extra quotation marks. The function print is defined in the prelude as
print :: Show a => a -> IO () print x = putStrLn (show x)
also, you could do:
putStrLn $ "insert " ++ show r
because the $ infix operator is just a tightly binding function application... you can think of it as a sort of left parenthesis that automatically adds a right parenthesis at the end of your expression. Jared.