When you are defining a class, the actual type that the class will accept can be further restricted. For example
:i Num
class Num a where
is shorthand for
class Num (a :: *) where
When you see the *, you should say in your head the word "type". Off topic, but In fact in future ghc releases, you will stop using * and use the Type type in its place, because it is clearer. So any Num instances require a single Type to be complete.
That means that only types that can be an instance of Num must have a kind *. Things that have that type are plain types that don't have extra variables, such as Int, (), and Char. If you tried to make Maybe an instance of Num it just wouldn't work.
Monad takes a different type
:i Monad
class Applicative m => Monad (m :: * -> *) where
It says that the only Monad instances take a Type and return a Type. For example Maybe takes a * and returns a *. That means you can apply Int, (), and Char to Maybe and you will get back a complete Type (ie. Maybe Int). So while Maybe can't be a num, Maybe Int absolutely can be an instance of Num. Other types that can be Monads - IO, [] (list) for example.
MonadTrans is even more involed
class MonadTrans (t :: (* -> *) -> * -> *) where
So, in this case it takes a type that is like Maybe or IO, and then also takes another that is like Int or Char. The standard example is StateT.
newtype StateT s (m :: * -> *) a
instance [safe] MonadTrans (StateT s)
So you can see how the types fit together. MonadTrans requires a type that has the right shape, and StateT s without the extra paramters fits perfectly.
So when you have a
newtype Scope b f a = Scope { unscope :: f (Var b (f a)) }
You can see that if a is a monomorphic type like Char or Int, then f has to be something like Maybe [], or IO, or Maybe. So you can see how Scope fits into both Monad and MonadTrans.
instance Monad f => Monad (Scope b f) where
instance MonadTrans (Scope b) where
Hopefully this gives you some intuition on how it works?