It has to do with the fact that F# can't tell what the type of the arguments are. Obviously, because you are boxing, you want the function to be as generic as possible. In addition, you completely ignore your third parameter (as seen in

1
fun _ -> (wp.Text <- (wp.Text ^ (translate v)))

). So, basically, when the new function is produced as a result of currying, you need to tell F# what types to expect (whether polymorphic or constrained). I don't know if this explanation is 100% technically accurate, but it is basically what is going on.

One way to do that is to declare wp_handler as

1
let wp_handler (x: 'a) (y: 'a) = handler windowPane x y

. This says that the last 2 parameters (though the last will be discarded) will be of the same type.

If you just want the last parameter as a means of triggering the handler's effect, you can change the final line of handler to

1
fun () -> (wp.Text <- (wp.Text ^ (translate v)))

. That way, wp_handler can be defined as

1
let wp_handler (x: 'a) = handler windowPane x

since F# already knows that the last parameter to handler is of type unit.

Hope this helps,

z.

By on 12/20/2007 5:20 PM ()
IntelliFactory Offices Copyright (c) 2011-2012 IntelliFactory. All rights reserved.
Home | Products | Consulting | Trainings | Blogs | Jobs | Contact Us | Terms of Use | Privacy Policy | Cookie Policy
Built with WebSharper