[Ur] Default settings using a generic record update

Adam Chlipala adamc at csail.mit.edu
Mon Oct 28 19:52:27 EDT 2019


On 10/28/19 3:27 PM, Mark Clements wrote:
> fun defaultSetting args =
>       update {A=1, B=1} args
>
> val _ = defaultSetting {A=2} (* {A=2, B=1} *)
> val _ = defaultSetting {B=2} (* {A=1, B=2} *)
The problem is that polymorphism in Ur/Web is always declared 
explicitly, not inferred as OCaml or Haskell.  You must add binders for 
type variables for defaultSettings just as you did for update.  (This 
statement applies to definitions of functions, not uses, so the two 
example calls above should work once you get defaultSettings defined 
properly.)



More information about the Ur mailing list