[Ur] common type for different functor instantiations

Adam Chlipala adamc at impredicative.com
Wed Nov 2 08:07:53 EDT 2011


Gergely Buday wrote:
> Thinking a bit about the original problem, I came to a change of aspect.
>
> I need not and must not export the underlying record. Better I should
> define the following:
>
> functor Render(sig con mRecord :: {Type}  end) : sig renderToXml :
> data ->  transaction xbody end
>
> Upon first call the renderToXml function should compute the underlying
> record, store it in a source cell and render normally. Upon later
> calls it should compute the record, compare to the previous one in the
> source cell, render so that differences are highlighted and store the
> record in the source cell.
>    

Functor application can't have [transaction] side effects on its own, so 
you'll probably want to introduce an abstract type in the functor output 
signature, to stand for the source and any other persistent 
information.  Further, you'll probably want to add a "method" to 
initialize such a value.



More information about the Ur mailing list