
24 May
2014
24 May
'14
1:08 p.m.
* adam vogt
Hi Dmitry,
It's pretty straightforward to use OverlappingInstances:
class Runnable a b where run :: a -> b
instance (r ~ (s -> (m (a,s)))) => Runnable (StateT s m a) r where run m = runStateT m
instance (r ~ (s -> (a,s))) => Runnable (StateT s Identity a) r where run m = runState m
Involving a type family doesn't simplify things, since you still need two class instances to choose between runStateT and runState.
So simple and so good. Thank you.
--
Best regards, Dmitry Bogatov