Instance of a type synonym

Apologies if this has been asked/answered many times over already - I am having a hard time formulating what the problem actually is & thus didn't really know what to look for already.

Essentially, I have a class I have defined such that :

class (MonadIO m) => Logger m where ...

And then I have a type (I want to say type synonym but I am not sure if this is the right 'term' ) :

type ResourceOpT r m a = StateT (ResourceCache r) m a

Why is that this instance is perfectly valid :

instance (MonadIO m) => Logger ( StateT s m )

But not this one (I guess the first one is more abstract/preferrable but I'm trying to understand why) :

instance (MonadIO m) => Logger ( ResourceOpT r m )

Shouldn't both be equivalent by virtue of how I have defined ResourceOpT? Specifically, the error I am getting is :

The type synonym 'ResourceOpT' should have 3 arguments, but has been given 2 In the instance declaration for 'Logger (ResourceOpT r m)'

I have a feeling what I am doing 'should' conceptually work but either my syntax is wrong or there is something (maybe a language extension) that I am missing or should be enabling for this to work. Regardless, I would be interested to get your input & learn why this is wrong & also why I should/should not be doing that.

Thanks in advance.

Read more here:

Content Attribution

This content was originally published by Althar93 at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: