changeset 1548:76dab73304a5

Document monadic shorthands
author Adam Chlipala <adam@chlipala.net>
date Wed, 24 Aug 2011 08:18:09 -0400
parents 553a5cc3a4b5
children 355a928871ff
files doc/manual.tex
diffstat 1 files changed, 2 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/doc/manual.tex	Sun Aug 21 13:41:57 2011 -0400
+++ b/doc/manual.tex	Wed Aug 24 08:18:09 2011 -0400
@@ -1389,6 +1389,8 @@
   \hspace{.1in} \to \mt{monad} \; \mt{m}
 \end{array}$$
 
+The Ur/Web compiler provides syntactic sugar for monads, similar to Haskell's \cd{do} notation.  An expression $x \leftarrow e_1; e_2$ is desugarded to $\mt{bind} \; e_1 \; (\lambda x \Rightarrow e_2)$, and an expression $e_1; e_2$ is desugared to $\mt{bind} \; e_1 \; (\lambda () \Rightarrow e_2)$.
+
 \subsection{Transactions}
 
 Ur is a pure language; we use Haskell's trick to support controlled side effects.  The standard library defines a monad $\mt{transaction}$, meant to stand for actions that may be undone cleanly.  By design, no other kinds of actions are supported.