On 03/07/2015 07:43 AM, Gabriel Riba wrote:
Until now I have used the following strategy for updating records

val newRec = r -- #Key -- #Value ++ {Key = k1, Value = v1}


but I guess that there must be a simpler syntax for this.

That's about the simplest syntax there is at the moment, though it is also possible to define a library function that hides use of the [---] operator to make the syntax a bit more compact.

fun overwrite [a] [b] [a ~ b] (r : $(a ++ b)) (r' : $b) : $(a ++ b) =
    r --- b ++ r'

val test = overwrite {A = 1, B = "", C = 2.3} {A = 8, C = 4.5}


_______________________________________________
Ur mailing list
[email protected]
http://www.impredicative.com/cgi-bin/mailman/listinfo/ur

Reply via email to