module Control.Monad.Class.MonadSay where import Control.Monad.Reader import qualified Data.ByteString.Char8 as BSC class Monad m => MonadSay m where say :: String -> m () instance MonadSay IO where say :: String -> IO () say = ByteString -> IO () BSC.putStrLn forall b c a. (b -> c) -> (a -> b) -> a -> c . String -> ByteString BSC.pack instance MonadSay m => MonadSay (ReaderT r m) where say :: String -> ReaderT r m () say = forall (t :: (* -> *) -> * -> *) (m :: * -> *) a. (MonadTrans t, Monad m) => m a -> t m a lift forall b c a. (b -> c) -> (a -> b) -> a -> c . forall (m :: * -> *). MonadSay m => String -> m () say