[Haskell-cafe] Mixing IO and STM

Jared Updike jupdike at gmail.com
Thu Dec 29 17:15:51 EST 2005


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.


More information about the Haskell-Cafe mailing list