TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: How viable is F# on Mono for real-life web apps?

44 pointsby herokusakiabout 11 years ago
The reason I&#x27;m asking is that F# appeals a lot to me (more so than Scala, the language that seems the closest competitor) but I have not found success stories from companies running their C# or F# web apps on Mono&#x2F;Linux.<p>As a separate but related question I would like to ask what tools you&#x27;d recommend for developing in F# on Linux or OS X.

14 comments

endeavourabout 11 years ago
It&#x27;s viable. Mono is very good these days. It&#x27;s pretty rare that you find .NET libraries that are incompatible. I still use Visual Studio as an IDE but deploying to Linux is straightforward.<p>Your options are (realistically): Websharper - full web stack, transparent RPC. Hard to interop with native JS libraries like angular though.<p>Funscript - F# to JS compiler, more minimalist approach.<p>F# server side (REST api in Nancy&#x2F;Fanciful&#x2F;WebAPI) teamed with javascript front-end. Also well worth checking out Livescript, syntax is very similar to F# but dynamically typed.<p>See also: A relevant blog article I posted: <a href="http://thecodedecanter.wordpress.com/2013/06/22/hosting-websharperasp-net-apps-on-linux-with-mono-nginx/" rel="nofollow">http:&#x2F;&#x2F;thecodedecanter.wordpress.com&#x2F;2013&#x2F;06&#x2F;22&#x2F;hosting-webs...</a><p>My consultancy (just in case): <a href="http://www.perfectshuffle.co.uk" rel="nofollow">http:&#x2F;&#x2F;www.perfectshuffle.co.uk</a><p>Always up for a chat if you have some ideas :) Shoot me an email through website above or PM me.
评论 #7543091 未加载
评论 #7546276 未加载
kevingaddabout 11 years ago
One big thing to watch out for is GC differences. Now that Mono has sgen the gap between it and MS&#x27;s CLR isn&#x27;t so huge, but you will definitely want to do some memory and CPU profiling direct on the webserver to spot any issues.<p>In my case when rolling out the JSIL compiler (mostly C#, but using some F# applications as test cases etc) certain BCL containers had dramatically different GC pressure profiles, and GCs would trigger at different rates and with different costs. F# tends to generate a lot of GC pressure so you want to be proactive about this.<p>Side-by-side, though, sgen works pretty well. I&#x27;ve used it extensively and it does the job.
orlandpmabout 11 years ago
At Tachyus (tachyus.com), we are using 100% F# to build the back end of our platform. Getting from zero to our first product deployment in three months, we&#x27;ve proven that F# is a great language for real world web projects -- especially when iteration speed and application correctness are both indispensable. Visual Studio and Windows Azure have actually been a huge part of the leverage we&#x27;ve gotten from choosing F#, as we can build, debug, deploy, and manage deployments directly from the IDE. With an Azure trial account created, you can literally get your first F# site up in minutes.<p>Unfortunately, I can&#x27;t answer your question about Mono just yet. We are exploring the practicality of Mono (for mobile development in F#), and while I am optimistic, I can&#x27;t speak to the reliability of the platform. So my answer (a complete cop-out) is to try out Visual Studio unless you are completely tethered to Linux&#x2F;Mac.
sitharusabout 11 years ago
With the new sgen GC it&#x27;s viable. The old Bohem-based GC was pretty terrible with F# as it allocates a huge number of transient objects.<p>As for tools, beyond frameworks Xamarin Studio has a good-enough F# environment. There&#x27;s also an emacs major mode.
DanielBMarkhamabout 11 years ago
I&#x27;d be curious as to what exactly you mean by &quot;success stories&quot;. If you mean something along the lines of &quot;is it easy to develop, has a robust environment, and doesn&#x27;t present any hard problems&quot; then I think there&#x27;s a lot of companies out there. If you mean something like &quot;will it help your company produce something people want&quot;? Then you&#x27;re asking the wrong question. Tech <i>very rarely</i> determines product-market fit, at least not to the degree that we developers think it does.<p>I&#x27;ve been using F#&#x2F;Mono for my small apps for some time now. For an example, my personal news aggregation site, <a href="http://newspaper23.com" rel="nofollow">http:&#x2F;&#x2F;newspaper23.com</a>, is running all the time, going out and finding headlines and presenting them to me in plain text. Been meaning to add a text stripper to the mix so I don&#x27;t have to see any ads or participate in any sticky website nonsense at all; just haven&#x27;t had time to code it yet.<p>The nice thing for me, especially for this app, is that I can use F# in a purely functional manner to create little unix-like programs that do a little bit of work at a time. Then I string them together with chron and, instead of the old client-server web model, I have something more resembling a data <i>pipeline</i>. I can monitor flow across the pipeline, distribute parts of it to other machines (scale out) if necessary, and so on. All without having to re-code anything. The entire thing serves up a static web page, which can also be tweaked: served in-place, over a CDN, emailed to a user, etc. Did I mention the &quot;no recoding&quot; part?<p>As a former .NET guy, I&#x27;m happy enough with F#&#x2F;mono that I can&#x27;t imagine going back to full-bore .NET no matter what the problem domain. The toolset is way too heavy, the culture is awash in folks marketing to developers instead of helping them build stuff people want, and so on. It was a great ride, but F#&#x2F;mono is where I get off.<p>Having said that, I still use the VS IDE to develop, since you can develop in windows and then FTP the code over. That&#x27;s pretty cool. I&#x27;ve tried and used MonoDevelop. I guess it&#x27;s okay. I&#x27;ve also done a bit with just straight-out command-line compiling. After all, it&#x27;s not like you need a huge codebase full of hundreds of files. Or if you do, you&#x27;re doing something wrong :) An 8 or 10-file F# program is a monster -- and probably means you&#x27;re trying to do too much at once.
graniczabout 11 years ago
In the past few weeks, we have been porting WebSharper IDE support (project templates, build, deploy and run) to MonoDevelop and Xamarin Studio, and apart from a couple smaller glitches this work is now done, and you should be seeing WebSharper for MD and XS released in the coming days. (Until then, you can manually invoke WebSharper if you are careful with the command line options and don&#x27;t mind scripting the process.)<p>We have not yet succeeded, though, in making CloudSharper Local run on mono due to some unimplemented methods in the mono stack. Once these are addressed, you can also develop mono&#x2F;Linux F# web apps in CloudSharper, and should hopefully find that experience a lot less daunting than using the conventional IDEs.
评论 #7544505 未加载
DenisMabout 11 years ago
Have you done the math for running it on windows rather than mono? Depending on your projected workload, it maybe fairly cheap.
autodidaktoabout 11 years ago
I played with Xamarin Studio + F# + OS X about a year or two ago. Right away I noticed that F# is a second class citizen in Xamarin. Weird bugs, weird warnings, unfinished parts, hard to find help online and in IRC channel. And since it&#x27;s a smaller language, there are 1&#x2F;100th the number of tutorials&#x2F;resources at much lower quality. Anyone who wanted to run my app on Linux or Mac had to deal with Mono 2 vs Mono 3. Despite spending a lot of time, I never figured out how to compile a windows binary on Mac or a Mac binary on Visual Studio (or how to have a project folder that works both in Xamarin and Visual studio without both git problems and linking problems). Starting a C# project is a pleasant experience, starting a F# required searching for add-ons and manual configuring (both in Xam and VS). I couldn&#x27;t even run the iOS sample app without paying hundreds of dollars for the full version because the iOS libraries made the binary (of the one page sample app) to big for the trial version. Response in IRC was &quot;yeah, we know. Oh well&quot;.<p>A real shame. I&#x27;d love to dedicate myself to an open source functional language with a GUI toolkit that runs all platforms, desktop and mobile.
评论 #7543742 未加载
评论 #7543326 未加载
platzabout 11 years ago
Mark Seemann made a nice tutorial on Pluralsight, which shows how to build an F# web app.<p>The demo isn&#x27;t using Mono, but I thought it&#x27;s still relevant if you want to get a feel for what an F# web app might look like.<p><a href="http://pluralsight.com/training/courses/TableOfContents?courseName=functional-architecture-fsharp" rel="nofollow">http:&#x2F;&#x2F;pluralsight.com&#x2F;training&#x2F;courses&#x2F;TableOfContents?cour...</a>
segphaultabout 11 years ago
Mono&#x27;s compatibility is quite good across the board, but there aren&#x27;t a ton of contributors focused on backend stuff. There are gaps in Mono&#x27;s library stack that are problematic for web applications (e.g. no System.Net.WebSockets last time I checked) but it&#x27;s not really all that bad.<p>Microsoft has started making a lot more of the ASP.NET stack open source (EntityFramework, Razor, etc), which I think will help a lot going forward. The real problem is that the ASP.NET happy path is somewhat coupled with IIS and (to a lesser extent) with MS SQL Server. It can be hard to get portability out of the box in some cases, but it depends a lot on what you are trying to do.
owlmonkeyabout 11 years ago
We have a product that has a C# web app deployed via mono on a linux box commercially shipping for four years. What I found was that with mono 2.10.6 it was fine as long as it was not loaded heavily, but under stress it would have stability issues. The socket layer was rewritten since then however and I&#x27;ve had less issues with 2.10.8&#x2F;9 but still fails under heavy load. More fixes have gone into mono 3. My sense is that it&#x27;s getting better but not nearly as battle tested compared to JVM-based network stacks. So if I was coding a large scale web service I&#x27;d consider Scala first.
评论 #7543703 未加载
runT1MEabout 11 years ago
are there features that F# has that scala is missing (aside from reified generics)? Because there are at least a few critical features scala has that F# is missing that influenced my decision on preferred language.
评论 #7543302 未加载
frozenportabout 11 years ago
Don&#x27;t do it because other people will have trouble with your code. Consider a job posting for F# vs one of the more commonly used languages.
评论 #7544180 未加载
sreanabout 11 years ago
TL;DR version: Felix is a very F#&#x27;ish language that might pique your interest. Felix is to C++ what F# is to C#<p>Full disclosure, this has been said of me recently: &gt; AFAICT you mention Felix whenever OCaml comes up, generally saying more or less the exact same thing each time<p>So you might know about Felix already, if not read on. I dont want to sound repetitive if it is not welcome please let me know if I am overdoing this, so far the reception has been warm in other threads. [Said too soon I guess, downvotes are ok, would appreciate if they come with some feedback as well]<p>Let me point you towards my comment <a href="https://news.ycombinator.com/item?id=7416692" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=7416692</a> that has more details<p>Felix&#x27;s website is running on the web server that comes with its standard library. It is well suited for webapps because of its strong support for efficient asynchronous I&#x2F;O, futures and coroutines (which I believe has been maintained for 10+ years and used in ATM networking applications). These help in avoiding callback heavy code. Hooks into JS is currently missing, but if you are adventurous, interfacing it with V8 should not be difficult because interfacing with C++ has been Felix&#x27;s design goal from the very beginning (analogous to how F# and C# are related). In fact if you express enough interest, the language designer, John Skaller, might be up for it himself (You can catch him on LTU or the Felix mailing list). As of now it has two backends, GCC and Clang. John has some interest in a Javascript backend as well in case there is sufficient demand for it. If F# is something that interests you, and the performance of F# on the mono runtime worries you a bit, Felix might be worth poking around, especially if you are an early adopter.
评论 #7543903 未加载