[Ur] Set / Update values within a structure
Harshita Kasera
hkasera at usc.edu
Thu Nov 9 22:42:22 EST 2017
Hello all,
I am trying to use a structure but, I am stuck at one point. This is my
structure definition -
*functor Make(M : sig*
* val callback : _*
* end) = struct*
* val cb = M.callback*
* fun simple nn =*
* cb(nn);*
* return nn*
*end*
What I am trying to do is to initiate a structure with a callback function.
Below demonstrates using a function debugMe as a callback. This works
totally fine.
*fun debugMe a =*
* alert a*
*structure AB = Mymaths.Make(struct*
* val callback = debugMe*
* end)*
*fun main()=*
*let*
* fun callMe () =*
* x <- AB.simple "test";*
* debug x*
*in*
* return <xml>*
* <body>*
* <h1> Sample </h1>*
* <button value="Click Me" onclick={fn _ => callMe()}></button>*
* </body>*
* </xml>*
*end*
What I ultimately want to achieve is to be able to change the callback
function *debugMe* at a later point of time. Is it possible to set or
update values within a structure at a later point of time?
I am new to urweb and SML in general so pardon me if this is really silly.
Any help would be really appreciated. Thanks a lot!
Regards,
Harshita
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.impredicative.com/pipermail/ur/attachments/20171109/02745751/attachment.html>
More information about the Ur
mailing list