[Haskell-cafe] New to Monads

2005-10-06 Thread Tom Hawkins
I'm just starting to feel comfortable working inside IO; now I am trying to wrap my head around Control.Monad.State. Looking at the implementation, I came across some unfamiliar syntax... class (Monad m) => MonadState s m | m -> s where What is the meaning of "| m -> s"? I found no mention o

Re: [Haskell-cafe] New to Monads

2005-10-06 Thread Cale Gibbard
That | m -> s reads "where m determines s", and means that there can be at most one s (here, the state type) for a given m (the monad type). This is used in type inference and checking to ensure that the type of state being carried around by a monad in MonadState is well defined, and to prevent you

Re: [Haskell-cafe] New to Monads

2005-10-07 Thread Wolfgang Jeltsch
Am Freitag, 7. Oktober 2005 06:32 schrieb Cale Gibbard: > That | m -> s reads "where m determines s", and means that there can > be at most one s (here, the state type) for a given m (the monad > type). This is used in type inference and checking to ensure that the > type of state being carried aro

Re: [Haskell-cafe] New to Monads

2005-10-07 Thread Christian Maeder
Tom Hawkins wrote: I'm just starting to feel comfortable working inside IO; now I am trying to wrap my head around Control.Monad.State. Looking at the implementation, I came across some unfamiliar syntax... class (Monad m) => MonadState s m | m -> s where For a simple state monad the class