[Ur] how to use conditions in monads?

Adam Chlipala adamc at impredicative.com
Mon Sep 5 07:41:40 EDT 2011


Vladimir Shabanov wrote:
> E.g. you can write
>    return 1;
>    theTwo<- return "2";
>    return three;
>    return foo
> and it will be just a sequence of computations with final result 'foo'
> (and intermediate results thrown away).
>    

Brief accuracy note here: the sequencing operator [;] in Ur enforces 
that the first computation returns [unit], so this example doesn't 
type-check.  This alternative does:

   return ();
   theTwo <- return "2";
   return ();
   return foo




More information about the Ur mailing list