Possible Duplicate:
What's the “|” for in a Haskell class definition?
I’m pretty new to Haskell. In the documentation of MonadState I see the following:
class Monad m => MonadState s m | m -> s where
get :: m s
put :: s -> m ()
What is the | m -> s syntax here?
It’s called a functional dependency or fundep for short. The syntax
means, that there is only one instance for each
mor – in other words, that ifmis known, the compiler can infer the type ofsform that. Using fundeps makes coding a lot easier, because the compiler can infer much more.