Commit 12121213 authored by Petr Pudlak's avatar Petr Pudlak

Add a MonadLog instance for strict variant of RWS

This allows to log in monad stacks containing RWS.
Signed-off-by: default avatarPetr Pudlak <pudlak@google.com>
Reviewed-by: default avatarKlaus Aehlig <aehlig@google.com>
parent 9515a7d2
...@@ -54,6 +54,8 @@ import Control.Applicative ((<$>)) ...@@ -54,6 +54,8 @@ import Control.Applicative ((<$>))
import Control.Monad import Control.Monad
import Control.Monad.Error (Error(..), MonadError(..), catchError) import Control.Monad.Error (Error(..), MonadError(..), catchError)
import Control.Monad.Reader import Control.Monad.Reader
import qualified Control.Monad.RWS.Strict as RWSS
import Data.Monoid
import System.Log.Logger import System.Log.Logger
import System.Log.Handler.Simple import System.Log.Handler.Simple
import System.Log.Handler.Syslog import System.Log.Handler.Syslog
...@@ -142,6 +144,9 @@ instance MonadLog IO where ...@@ -142,6 +144,9 @@ instance MonadLog IO where
instance (MonadLog m) => MonadLog (ReaderT r m) where instance (MonadLog m) => MonadLog (ReaderT r m) where
logAt p = lift . logAt p logAt p = lift . logAt p
instance (MonadLog m, Monoid w) => MonadLog (RWSS.RWST r w s m) where
logAt p = lift . logAt p
instance (MonadLog m, Error e) => MonadLog (ResultT e m) where instance (MonadLog m, Error e) => MonadLog (ResultT e m) where
logAt p = lift . logAt p logAt p = lift . logAt p
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment