Mercurial > urweb
changeset 2025:afeeabdcce77
let..where..end
author | Adam Chlipala <adam@chlipala.net> |
---|---|
date | Wed, 11 Jun 2014 14:22:47 -0400 (2014-06-11) |
parents | 6372a742ab04 |
children | 73e54a6aba79 |
files | doc/manual.tex src/urweb.grm tests/letwhere.ur |
diffstat | 3 files changed, 10 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/doc/manual.tex Thu Jun 05 20:36:12 2014 +0000 +++ b/doc/manual.tex Wed Jun 11 14:22:47 2014 -0400 @@ -625,6 +625,8 @@ A signature item $\mt{table} \; x : c$ is shorthand for $\mt{val} \; x : \mt{Basis}.\mt{sql\_table} \; c \; []$. $\mt{view} \; x : c$ is shorthand for $\mt{val} \; x : \mt{Basis}.\mt{sql\_view} \; c$, $\mt{sequence} \; x$ is short for $\mt{val} \; x : \mt{Basis}.\mt{sql\_sequence}$. $\mt{cookie} \; x : \tau$ is shorthand for $\mt{val} \; x : \mt{Basis}.\mt{http\_cookie} \; \tau$, and $\mt{style} \; x$ is shorthand for $\mt{val} \; x : \mt{Basis}.\mt{css\_class}$. +It is possible to write a $\mt{let}$ expression with its constituents in reverse order, along the lines of Haskell's \cd{where}. An expression $\mt{let} \; e \; \mt{where} \; ed^* \; \mt{end}$ desugars to $\mt{let} \; ed^* \; \mt{in} \; e \; \mt{end}$. + \section{Static Semantics}
--- a/src/urweb.grm Thu Jun 05 20:36:12 2014 +0000 +++ b/src/urweb.grm Wed Jun 11 14:22:47 2014 -0400 @@ -1456,6 +1456,7 @@ | UNDER (EWild, s (UNDERleft, UNDERright)) | LET edecls IN eexp END (ELet (edecls, eexp), s (LETleft, ENDright)) + | LET eexp WHERE edecls END (ELet (edecls, eexp), s (LETleft, ENDright)) | LBRACK RBRACK (EVar (["Basis"], "Nil", Infer), s (LBRACKleft, RBRACKright))