# HG changeset patch # User Adam Chlipala # Date 1402510967 14400 # Node ID afeeabdcce77c359368453c4eb3b2eb629198c28 # Parent 6372a742ab040fa28a9099249a364129595c0807 let..where..end diff -r 6372a742ab04 -r afeeabdcce77 doc/manual.tex --- 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} diff -r 6372a742ab04 -r afeeabdcce77 src/urweb.grm --- 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)) diff -r 6372a742ab04 -r afeeabdcce77 tests/letwhere.ur --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/tests/letwhere.ur Wed Jun 11 14:22:47 2014 -0400 @@ -0,0 +1,7 @@ +fun main () : transaction page = + let + return Hi {[alice]} and {[bob]}! + where + val alice = "Alice" + val bob = "Bob" + end