Let's use ghci to inspect the kinds:
*Main> :k Toto
Toto :: * -> * -> *
Toto
takes two type parameters: the environment type and the return type. If r
is the environment, Toto r
will be the monad type constructor.
*Main> :k TotoReader
TotoReader :: (* -> *) -> * -> Constraint
TotoReader
takes two type parameters: the monad type constructor and the environment type, which in our case are Toto r
and r
respectively.
So, the instance declaration should be something like:
instance TotoReader (Toto r) r where
get = toto $ \x -> (x, x)