
7 Jun
2011
7 Jun
'11
11:08 a.m.
On Tuesday 07 June 2011, 16:59:44, djp@arqux.com wrote:
I am confused about the definition of MonadState. The opening line looks like this:
class Monad m => MonadState s m | m -> s where
It is the vertical bar | that confuses me. What does that mean? How would one read this line in "natural language", say English?
The vertical bar signifies a functional dependency (cf. the ghc users' guide for details). It says here, that the monad determines the type of the state. Read it class (demanding a Monad instance for m) MonadState m s, m determining s uniquely, where ...