E.g. in the following code
class Monad m => Logger m where
logStr :: String -> m ()
newtype TheLoggerReader m a = TheLoggerReader (m a)
deriving (Functor, Applicative, Monad)
instance (HasReader "logger" (String -> IO ()) m, MonadIO m) => Logger (TheLoggerReader m)
newtype CountLogM m a = CountLogM (ReaderT CountLogCtx m a)
deriving (Functor, Applicative, Monad)
deriving Logger via
(TheLoggerReader (Field "logger" (Field "logCtx" (MonadReader (ReaderT CountLogCtx m)))))
the deriving Logger via clause requires MonadIO instances for Field and MonadReader.
It might happen that a user is forced to define orphan instances for newtypes like MonadReader for type-classes that where not anticipated in this package. This may be unavoidable. However, we should make sure to systematically provide instances for a set of select common type-classes for all newtypes defined in this package.
See #4 (comment)
E.g. in the following code
the
deriving Logger viaclause requiresMonadIOinstances forFieldandMonadReader.It might happen that a user is forced to define orphan instances for newtypes like
MonadReaderfor type-classes that where not anticipated in this package. This may be unavoidable. However, we should make sure to systematically provide instances for a set of select common type-classes for all newtypes defined in this package.See #4 (comment)