Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I love seeing F# mentioned on Hacker News, but this article in particular is a bit dubious. Yes, you can use F# from C#, but it gets frustrating quickly.

Fortunately, almost anything you can do in C# can be done better in F# anyway, so there's really very little need to use C# at all once you take the plunge into functional programming.



I agree - I guess this article is more about a (very) gradual way to adopt F# into an existing C# code base, rather than an inherently useful combination of C# and F#.


True, but for any serious integration the F# library should expose an API that's designed to be more idiomatic for C# callers. When I see `ListModule.OfSeq` being called from C#, I cringe a little.


Would you mind sharing some of the frustrations you have had using F# from C#? I haven't hit anything too hard yet but I also haven't worked on any large projects that are setup like that.

In regards to the C# vs F# issues. Have you tried using WPF or any desktop GUI frameworks from F#? If so how was the experience?


Here's a quick example of the kind of trouble you can easily get into when calling idiomatic F# from C#: https://stackoverflow.com/questions/1952114/call-a-higher-or...

It's been a few years, but yes, I've implemented WPF apps in F# and found it quite doable. FsXaml was very helpful: https://fsprojects.github.io/FsXaml/


Thanks for the information! I figured I hadn't really scratched the surface on this stuff.

I'm quite interested in making a GUI from a functional language. This could be a good way to kick the tires.


Reactive Programming I guess is the key to GUIs from F#/FP perspective. It is the modern way of doing things anyway but requires then a UI stack which is optimized for it.


Ah funnily enough I did use that a fair amount in my C#/WPF days. Rx does indeed seem like a good fit.


C# is required for the UI programming, though. I don’t know any F# module, which interacts and manipulates UI elements. Yes, creating a web UI is possible, but not for the desktop.

I’d love if someone could point the way around (because until today, I’ve to combine both languages for desktop appt)


Avalonia does Just Work from F#; it even has `dotnet new` templates for F# (https://github.com/AvaloniaUI/avalonia-dotnet-templates).


Also check out Avalonia.FuncUI: https://github.com/fsprojects/Avalonia.FuncUI




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: