[Haskell-beginners] How to interpret the definition of MonadState

djp at arqux.com djp at arqux.com
Tue Jun 7 17:35:45 CEST 2011


Thanks, Daniel.

Quoting Daniel Fischer <daniel.is.fischer at googlemail.com>:

> On Tuesday 07 June 2011, 16:59:44, djp at 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.

Does that mean it's ghc specific, i.e. not in Haskell 98 / 2010?

>
> Read it
>
> class (demanding a Monad instance for m) MonadState m s, m determining s
> uniquely, where ...
>






More information about the Beginners mailing list