[Ur] Compilation error using onchange with ccheckbox

Julian Squires julian at cipht.net
Fri Jul 24 08:30:05 EDT 2015


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



More information about the Ur mailing list