2011/9/5 Gergely Buday <[email protected]>: >> stored <- get store; >> input <- get counter; >> if (stored <> input) >> then set var value >> else <nop> >> sleep 100; > > Vladimir wrote: > >> Try 'return ()' >> >> (if ... then ... else return ()); ... > > If I understand correctly, I can use return only at the end of a monad > chain, can't I?
No. 'return' is not a control structure (not the same 'return' as in C or Java), it is just a function, and 'return x' is just a monadic computation which (when performed) returns 'x'. E.g. you can write return 1; theTwo <- return "2"; return three; return foo and it will be just a sequence of computations with final result 'foo' (and intermediate results thrown away). _______________________________________________ Ur mailing list [email protected] http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
