[Haskell-cafe] flipped IO sequence

2008-10-01 Thread Cetin Sert
warn :: String → IO Int warn = return 1 << putStrLn-- causes an error -- = \msg → return 1 << putStrLn msg -- works just fine -- = \msg → putStrLn msg >> return 1 -- works just fine (<<) :: Monad m ⇒ m b → m a → m b b << a = a >>= \_ → b Why do I get this compile-time error?? How

Re: [Haskell-cafe] flipped IO sequence

2008-10-01 Thread Dougal Stanton
2008/10/1 Cetin Sert <[EMAIL PROTECTED]>: > warn :: String → IO Int > warn = return 1 << putStrLn-- causes an error > -- = \msg → return 1 << putStrLn msg -- works just fine > -- = \msg → putStrLn msg >> return 1 -- works just fine > > (<<) :: Monad m ⇒ m b → m a → m b > b << a = a

Re: [Haskell-cafe] flipped IO sequence

2008-10-01 Thread Martin Huschenbett
Hi Cetin, what you seem to want is > warn :: String -> IO Int > warn = (return 1 <<) . putStrLn Cetin Sert schrieb: > warn :: String → IO Int > warn = return 1 << putStrLn-- causes an error > -- = \msg → return 1 << putStrLn msg -- works just fine > -- = \msg → putStrLn msg >> re

Re: [Haskell-cafe] flipped IO sequence

2008-10-01 Thread Daniel Fischer
Am Mittwoch, 1. Oktober 2008 12:18 schrieb Cetin Sert: > warn :: String → IO Int > warn = return 1 << putStrLn-- causes an error try warn = (return 1 <<) . putStrLn > -- = \msg → return 1 << putStrLn msg -- works just fine > -- = \msg → putStrLn msg >> return 1 -- works just fine

Re: [Haskell-cafe] flipped IO sequence

2008-10-01 Thread Luke Palmer
2008/10/1 Cetin Sert <[EMAIL PROTECTED]>: > warn :: String → IO Int > warn = return 1 << putStrLn-- causes an error > -- = \msg → return 1 << putStrLn msg -- works just fine > -- = \msg → putStrLn msg >> return 1 -- works just fine > > (<<) :: Monad m ⇒ m b → m a → m b > b << a = a