[Haskell-cafe] Monad Imparative Usage Example

Brian Hulley brianh at metamilk.com
Sat Aug 5 08:30:44 EDT 2006

Brian Hulley wrote:
>    q >>= (\x -> p)
> For example with the State monad, (q) must be some expression which
> evaluates to something of the form S fq where fq is a function with
> type s -> (a,s), and similarly, (\x -> p) must have type a ->S ( s ->
> (a,s)). If we choose names for these values which describe the types
> we have:
>    q = S s_as
>    p = a_S_s_as

Sorry I meant:

      (\x -> p) = a_S_s_as

('p' and 'q' stand for arbitrary expressions that evaluate to monadic 

Regards, Brian.
Logic empowers us and Love gives us purpose.
Yet still phantoms restless for eras long past,
congealed in the present in unthought forms,
strive mightily unseen to destroy us.


More information about the Haskell-Cafe mailing list