[Ur] Too restrictive syntax sugar for monads (bug #127).

Alexei Golovko m-lj at yandex.ru
Fri Feb 17 11:40:04 EST 2012


In Haskell 'do { e1; e2 }' expands to 'bind e1 (\_ -> e2) ' and does not fix "return type" of 'e1'. This is usable, for example, with parser combinators, where we often need call parser and discards its value. Another example --- IO action, which returns some non-interesting technical details (as num of inserted rows or elapsed time).

In Ur, one need noisy 'ignore e1; e2' or (with unused free in 'e2' variable) '_i <- e1; e2' if type 'e1' is not 'm {}'. Does this really help to prevent errors? Which kinds? I am sure, the cost is too large.

At least, this difference should be documented in the reference manual: I have thought that improperly declared monad for a some time.

PS. And also fix typo in chapter 4.1, Lexical conventions, of manual.pdf: in the second row of table ASCII representation of long arrow should be '-->' but is '->'



More information about the Ur mailing list