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 >>= \_ → b
>
> Why do I get this compile-time error?? How can one define << ?

While this isn't directly what you're doing, you might be interested
in the Kleisli composition operators in Control.Monad:

  (>=>) :: (Monad m) => (a -> m b) -> (b -> m c) -> (a -> m c)
  (<=<) :: (Mnoad m) => (b -> m c) -> (a -> m b) -> (a -> m c)

Luke
_______________________________________________
Haskell-Cafe mailing list
Haskell-Cafe@haskell.org
http://www.haskell.org/mailman/listinfo/haskell-cafe

Reply via email to