
Hello! I am working on package to generalize
common `runSomeThing` and `runSomethingT` functions.
It is very easy to generalize runStateT and runReaderT
like
class Runnable a where
type RunResult a
run :: a -> RunResult a
instance Runnable (StateT s m a) where
--- Why ScopedTypeVariables do not work here?
type RunResult (StateT s m a) = s -> m (a, s)
run = runStateT
--- ReaderT absolutely the same
But problem is that `State s a` is in fact `StateT s Identity a` and
I get type family conflicts.
In fact, it boils down to following:
type family TestIdentity (m :: * -> *)
type instance TestIdentity Identity = Int
type instance TestIdentity m = () -- Anything but Identity.
In general, with all this TypeClass magic, I have a lot of ways that
something belong to some class, and no (aside OverlappingInstances)
to tell that it does NOT belong. I belive, there is reason to, but I do
not see it. Also, seems even TH does not helps here.
PS. Please, keep me in To:
--
Best regards, Dmitry Bogatov