Generalize MonadSafe to allow another base monad than IO