{-# LANGUAGE FlexibleInstances #-} module Control.Monad.STM.Class where import Control.Concurrent.STM (STM, atomically) import Control.Monad.Trans.Class (MonadTrans(lift)) class MonadSTM m where liftSTM :: STM a -> m a instance MonadSTM STM where liftSTM = id instance MonadSTM IO where liftSTM = atomically instance (Monad m, MonadSTM m, MonadTrans t) => MonadSTM (t m) where liftSTM = lift . liftSTM