[Haskell-cafe] Fundep Curiosity

Daniel Fischer daniel.is.fischer at web.de
Tue May 12 08:41:04 EDT 2009

Am Montag 11 Mai 2009 18:36:54 schrieb Christopher Lane Hinson:
> I've noticed that a large majority of fundeps I see in other people's
> libraries are written:
> class C a b | b -> a
> Where the dependent parameter appears first in the MPTC.  Is there a
> reason for this?

Yes. Generalised newtype deriving (perhaps others, but that's what jumped at me).


class MonadState s m | m -> s where ...

newtype State s a = State { runState :: s -> (a,s) }

instance Monad (State s) where ...

instance MonadState s (State s) where ...

newtype MySpecialState s a = MSS (State (s,Int) a)
	deriving (Monad, MonadState (s,Int))

> AFAIK, there isn't any semantic significance to the order of parameters in
> an MPTC.  Why do many haskellers find this configuration more intuitive?
> Friendly,
> --Lane

More information about the Haskell-Cafe mailing list