In general, you can't, not with these type signatures, since printing something is a side effect.
If this is only for debugging purposes, you might try using trace from IOExts. You can use it in a nice fashion like: > f1 :: Int -> Int > f1 x > | trace ("The initial value is " ++ show x) False = undefined > | otherwise = f2 x In general, the 'trace ... False = undefined' thing is quite useful, but note that trace uses unsafePerformIO and very little is guarenteed about the output (especially the ordering might be different than you would expect...but it's usually fine for debugging purposes). On 13 Oct 2003, Jose Morais wrote: > Hi, > > I am trying to something like > > f1 :: Int -> Int > f1 x = f2 x > > f2 :: Int -> Int > f2 x = 2 * x > > > but before f2 returns its result I'd like it to print something like > "The initial value is " ++ show x. > > How could I do this? > > > Thank you > > _______________________________________________ > Haskell-Cafe mailing list > [EMAIL PROTECTED] > http://www.haskell.org/mailman/listinfo/haskell-cafe > -- Hal Daume III | [EMAIL PROTECTED] "Arrest this man, he talks in maths." | www.isi.edu/~hdaume _______________________________________________ Haskell-Cafe mailing list [EMAIL PROTECTED] http://www.haskell.org/mailman/listinfo/haskell-cafe