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 >> 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 can one define << ? > > [EMAIL PROTECTED]:~/lab/test/qths/p> ghc -fglasgow-exts -O2 -o d64x > --make demo2.hs system.hs > [1 of 2] Compiling Netman.System ( system.hs, system.o ) > > system.hs:23:14: > No instance for (Num (IO Int)) > arising from the literal `1' at system.hs:23:14 > Possible fix: add an instance declaration for (Num (IO Int)) > In the first argument of `return', namely `1' > In the first argument of `(<<)', namely `return 1' > In the expression: return 1 << putStrLn > > > ------------------------------------------------------------------------ > > _______________________________________________ > Haskell-Cafe mailing list > Haskell-Cafe@haskell.org > http://www.haskell.org/mailman/listinfo/haskell-cafe _______________________________________________ Haskell-Cafe mailing list Haskell-Cafe@haskell.org http://www.haskell.org/mailman/listinfo/haskell-cafe