On Fri, Jan 21, 2011 at 7:58 PM, Casey Hawthorne <cas...@istar.ca> wrote: > uj supplied this: > > About the discussion > "putStrLn (readLn + (5 :: Int))".. > > I'll write it as the following line, > > importing Control.Applicative > main = (+) readLn (return 3) > > They look almost exactly same in my eyes..
You're missing some bits. main = print =<< liftM2 (+) readLn (return 3) Which I assert looks like more line noise than some perl programs I've read. :) Now, you *can* get away with simplifying this to main = print =<< (readLn :: IO Int) + 3 assuming instance Num a => Num (IO a), which sort-of works (show instance and pattern matching are both quite broken; given the naive implementation of fib, fib readLn will give you quite a surprising result!) But I think this case proves the point quite well: it's a special case where Num turns out to be very friendly. Why can't the whole language be that friendly? -- ryan _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe