-
Notifications
You must be signed in to change notification settings - Fork 50
Closed
Description
When defining monad transformers as newtypes over IdentityT
or ReaderT r
, I'd like to simply derive an instance for UnliftIO
with the newtype
strategy,
newtype Newtype m a = Newtype (m a)
deriving newtype (Functor, Applicative, Monad, MonadIO, MonadUnliftIO)
However, this currently fails with the error
• Couldn't match representation of type ‘m (UnliftIO (Newtype m))’
with that of ‘m (UnliftIO m)’
arising from the coercion of the method ‘askUnliftIO’
from type ‘m (UnliftIO m)’
to type ‘Newtype m (UnliftIO (Newtype m))’
NB: We cannot know what roles the parameters to ‘m’ have;
we must assume that the role is nominal
• When deriving the instance for (MonadUnliftIO (Newtype m))
This could be avoided by moving the askUnliftIO
method out of the class definition. This is pretty much the breaking part of #13.
effectfully and IzumiRaine
Metadata
Metadata
Assignees
Labels
No labels