A lot of restrictions seem to come together. Let me distract them.
type MonadNumState am = (MonadState am, Num a)
MonadNumState is simply synonymous with limitations, so I get the benefits of functional dependencies every time I use it and I can easily put MonadNumState am in context. Now suppose I want to distract this in a family of constraints:
class Iterator t where type MonadIter tam :: Constraint next :: (MonadIter tam) => mt ... instance Iterator Foo where type MonadIter Foo am = (MonadState am, Num a) ... instance Iterator Bar where type MonadIter Bar am = (MonadRandom m, MonadSplit am, RandomGen a) ...
But now a not a functional dependency. next almost never used, since a cannot be inferred. What can I do? Well, I could, of course, use a type family. MonadState is written using fundeps, but it is easy to convert to family types.
instance (MonadState sm) => MonadStateFamily m where type St m = s get' = get ... instance (MonadStateFamily m) => MonadState (St m) m where get = get' ...
I donβt think so.
Foo.hs:25:3: The RHS of an associated type declaration mentions type variable `s' All such variables must be bound on the LHS
What else can I do? What I really want is to existentially quantify s . I did not find any way to do this without explicitly going into the dictionary.
So, how do I get the benefits of drives for families with disabilities?
source share