24 May
2014
24 May
'14
5:08 p.m.
* adam vogt <vogt.adam@gmail.com> [2014-05-24 12:27:18-0400]
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 <KAction@gnu.org>, Free Software supporter, esperantisto and netiquette guardian. git://kaction.name/rc-files.git GPG: 54B7F00D