[Ur] java-script calls are optimised out

Adam Chlipala adamc at csail.mit.edu
Thu Oct 3 16:48:29 EDT 2013


On 10/03/2013 01:40 PM, Sergey Mironov wrote:
> Oh, yes, Thanks! I should have read the manual more carefully.
> benignEffectful helped me. Still, the contract looks unusual (after IO
> of Haskell). Did you think about including part of the contract in the
> type signatures? I mean that we probably could have transaction monad
> parametrized with some type indicating 'effectfulness'.
>    

I've thought about deducing such information automatically from FFI 
signatures, considering any [transaction]-typed function to be 
effectful.  It would still be important to think about each function and 
whether its effect is "benign" (page-local) or not, but I'll plan to 
experiment with adding [transaction]al functions as non-benign effectful 
by default.

> By the way, here is another idea of this kind, bothering me since I
> started to explore Ur: can (should) we actually parametrize the
> transaction monad with the 'side' type indicating server-side,
> client-side or  'any side' ? Currently, programmer should keep the
> side in mind, `alert' is the example (it has `transaction unit' type,
> still we should not call it from the server side context). If we
> lifted this information to the type annotations, we would then have
>
> type client_side
> type server_side
>
> val alert : string ->  transaction client_side unit
> val getServerEnv : string ->  transaction server_side (option string)
>
> (* should work on both server and client sides *)
> val debug : t ::: Type ->  string ->  transaction t unit
>
> AFAIK the compiler already keeps all distinctions of this kind
> internally! So what can go wrong with this?
>    

I agree that it would be better to use types to track the sorts of 
effects that a [transaction] can have.  I have a variety of other ideas 
to remove some of the other not-very-compositional aspects of the way 
Ur/Web works right now, and my plan is to tackle all of these some day 
in a complete rewrite.



More information about the Ur mailing list