[Haskell-cafe] Typeclasses -- if does not satisfy
KAction at gnu.org
Sat May 24 17:08:01 UTC 2014
* adam vogt <vogt.adam at 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 at gnu.org>,
Free Software supporter, esperantisto and netiquette guardian.
More information about the Haskell-Cafe