[Ur] typing bind

Adam Chlipala adamc at impredicative.com
Wed Aug 24 08:13:26 EDT 2011


Gergely Buday wrote:
> one more question about the semicolon operator:
>
> when there are a number of<- operators, and a return at the end,
> then, the right-associativity of bind let me compute the type of the
> expresson
>
> x1<- f y1;
> x2<- g y2;
> return xml = bind ( f y1) (fn x1 =>  bind (g y2) (fn x2 =>  return xml))
>
> But what can I do when there are more non-<- lines at the end, like
>
> fun write t s =
>      oldTail<- get t.Tail;
>      newTail<- source End;
>      set oldTail (Line (s, newTail));
>      set t.Tail newTail
>    

The syntax [e1; e2] is sugar for [bind e1 (fn () => e2)].  I hope that 
answers the question.



More information about the Ur mailing list