[Ur] Empty transaction

Ziv Scully zivscully at gmail.com
Thu Jan 23 10:59:25 EST 2020


As you mentioned in your other email, "return ()" is a no-op.

Right now I think your code won't do quite what you want. It currently
builds a transaction that will set at most one source, whereas I think
you're trying to set all of them. This is because you're dropping the "acc"
argument in the function. Changing the function to

  (fn [nm :: Name] [t ::_] [rest ::_] [[nm] ~ rest] t s acc =>
    acc; set s t.Default
  )

should fix that. Even better, use Monad.appR2 (see lib/ur/monad.urs in the
Ur/Web directory), which is a specialized version of foldR2.


On Thu, Jan 23, 2020 at 3:35 AM Urs Wegmann <urs at wegmann-informatik.ch>
wrote:

> Is there a way to create a transaction that does nothing? Something like:
> val noop : unit -> transaction unit
>
> The closest thing of this I'm aware of is:
> val debug : string -> transaction unit
>
> My use case is:
> @foldR2
>   [colInfo]
>   [source]
>   [fn _ => transaction unit]
>   (fn [nm :: Name] [t ::_] [rest ::_] [[nm] ~ rest] t s acc =>
>     set s t.Default
>   )
>   (debug "reset sources")
>   M.fl
>   M.t
>   sources
>
> I'm quite new to Ur, so maybe there is a better way to achieve the same.
>
>
>
> _______________________________________________
> Ur mailing list
> Ur at impredicative.com
> http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20200123/9023502a/attachment.html>


More information about the Ur mailing list