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