I have been hearing about F# and Microsoft now have a guy who is blogging and coding away in redmond somewhere about it. Can you really write GUI code from F# (I\'d love to see
I'd highly recommend this excellent post by Scott Hanselman, which points to some F# resources including examples and presentations.
I haven't actually used F#, only read the specs. It may be great for WinForms development, but my immediate reaction to this is "it doesn't really matter". As long as you use CLR compliant compilers you should be able to mix F# assemblies with others written in C#/IronPython/etc.
Yes, F# can use the .NET Framework, and F# assemblies can be used by other .NET assemblies.
My advice would be to code your functional libraries in F# and then use whichever .NET language you fancy to write the client app(s).
But as Jon Skeet says, Tomas has some interesting examples (especially filtering/piping events), which show what I suspect may be a good cross-over point, i.e., design your C# GUI with designer, and then write the brains in F#, hooking one to the other with events.
That's I think a very good approach. Designing complex GUIs without WinForms designer is a bit annoying (though, the difference isn't that big in WPF - F# doesn't support WPF designer, but you don't loose that many things there).
Anyway, stay tuned for more examples :-). Using declarative event handling (Event.filter, Event.map & friends) is quite nice, but in some cases it isn't quite what you want to. I'm just writing a chapter about that and I think F# gives you some really awesome ways to deal with GUIs - the source code will be freely available on the book web site and I'll hopefuly write some short intro for my blog as well once the book will be done.
Yes, you can certainly write WinForms apps - although you wouldn't override the OnClick method, you'd subscribe to the Click event.
Yes, F# has full access to .NET, although you won't get very idiomatic functional code if you use a lot of mutable types.
Tomáš Petříček's F# web site has sample source code from his book (disclaimer: I'm involved with the book too, so I'm clearly biased) which has WinForms examples.
You CAN write GUI code from F#, but I'm not sure that you'd WANT to. If you are the kind who wrote your C# GUIs in notepad anyway, then it probably wouldn't bother you. Personally I prefer the designer, and there isn't one for F#, and as far as I've understood it, there isn't going to be one either - which probably says something about the intended use of F#.
But as Jon Skeet says, Tomas has some interesting examples (especially filtering/piping events), which show what I suspect may be a good cross-over point, i.e., design your C# GUI with designer, and then write the brains in F#, hooking one to the other with events.