[Ur] Compilation error using onchange with ccheckbox

Graham Hopper graham at garden-images.co.uk
Sat Jul 25 07:30:50 EDT 2015


Julian - Thank you for the suggestion and explanation. It works now
Sergey - Thank you for answering my follow up question before I had even
asked.

Graham


Graham Hopper
Director
t: 01789 292618
f: 0845 86 220 86
w: forsomethingdifferent.com
fb: facebook.com/forsomethingdifferent

On Sat, Jul 25, 2015 at 7:31 AM, Sergey Mironov <grrwlf at gmail.com> wrote:

> You may check the type signatures by consulting basis.urs from the
> Ur/Web's repo. Among other 'built-in' declarations, we may find there
>
> val ccheckbox : cformTag ([Value = bool, Size = int, Source = source
> bool, Onchange = transaction unit] ++ boxAttrs ++ inputAttrs) []
>
> ...  Onchange = transaction unit ...
>
> That is how Juian may 'know in advance' the correct style :)
>
> Regards,
> Sergey
>
>
>
> 2015-07-24 15:30 GMT+03:00 Julian Squires <julian at cipht.net>:
> > On Fri, Jul 24, 2015 at 7:49 AM, Graham Hopper
> > <graham at garden-images.co.uk> wrote:
> >>             <ccheckbox onchange={fn _ => alert "Changed!"}/>
> >
> > Try
> >   <ccheckbox onchange={alert "Changed!"} />
> >
> >> The error is long winded but I think the important part is:
> >>
> >>    Need:
> >> <UNIF:U52::{Type}> ++ [Onchange = <UNIF:U69::Type> -> transaction {}]
> >>   Field:  #Onchange
> >> Value 1:  transaction {}
> >> Value 2:  <UNIF:U69::Type> -> transaction {}
> >> Incompatible constructors
> >> Have:  transaction {}
> >> Need:  <UNIF:U69::Type> -> transaction {}
> >
> > Onchange has the signature transaction unit, where as you might have
> > expected it to be like the mouse events (onclick, et cetera) which
> > have signature mouseEvent -> transaction unit, which is why they are
> > typically written with an anonymous function that discards its
> > arguments as you did above.
> >
> > Hope this helps,
> >
> > --
> > Julian Squires
> >
> > _______________________________________________
> > Ur mailing list
> > Ur at impredicative.com
> > http://www.impredicative.com/cgi-bin/mailman/listinfo/ur
>
> _______________________________________________
> 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/20150725/0cd75b50/attachment.html>


More information about the Ur mailing list