WebSharper: Make web apps in F# - <AUTHOR> http://websharper.com/ <comment><USER2> It's well intentioned, but this project is destined to go nowhere fast.

Abstracting away web development and http has been tried again and again, and always ends up being more hassle than plain ol' HTML+JS+HTTP.

Then you've limited yourself to interop with the js libraries they've provided leaky wrappers over, or you can write your own leaky wrapper if you want to use coolnewthing.js you saw on github.

And to cap it all, this framework requires commercial licensing for closed source projects!

<comment><USER3> It's been around for a few years. I was able to use it to quickly whip up some sorta-complicated UIs for some internal tools. I despise JS, and have spent hours of time fixing simple casing errors or other things that static typing would fix. Plus F# the language is quite superior to JS, so I don't feel icky while working on it.

The other benefit is that I can use all the same type definitions, so I don't need to write some generator or wrapper around my XHR functions - it just works.

It's quite easy to just drop out into pure JS if you feel the need. And defining wrappers is actually very very simple. For example:

      [<Direct "foo($a, $b)">]
      let foo (a: string) (b: int) = ()

Doesn't Google use a Java-based system to do essentially the same thing (GWT)?

But you're right that if you are already happy with JS then there's a lot less reason to pick it up.

<comment><USER4> GWT has long-ish compile times and it involves quite a house of cards, with getting the Eclipse plugin to talk to the browser plugin, for the 1? browser that actually has a plugin. Yeesh :(

<comment><USER5> Fixed in GWT 2.7 builds (already available):

[https://www.youtube.com/watch?v=qpCSbj36O44&feature=youtu.be](https://www.youtube.com/watch?v=qpCSbj36O44&feature=youtu.be)

</comment></comment></comment></comment><comment><AUTHOR> This looks super interesting. I don't think I've ever seen anything like it.

At first I thought it was similar to Classic ASP or JSPs, but after looking at some the examples, it's more like a JS framework in that it generates HTML dynamically with client side code. But, the thing that really looks cool to me is the interop between client and server that you can do.

You can use the exact same "type Person = {Name:string; DOB:DateTime;}" on the server and client. That's about as DRY as you can get, I think.

<comment><USER3> It's a F#-to-JS compiler, a UI framework, and an RPC system all built into one. Script# is similar, for C#, but I don't think it got that far? MS did start "Project Volta" IIRC but then gave up on it. There's also FunScript: [http://funscript.info/](http://funscript.info/) but that seems more focused only on the JS generation part.

I don't know why Micrsoft doesn't buy these guys and deliver this as a core solution. I'd guess it's because it's not on C#, and MS marketing doesn't know what to do with F#. They want to pigeonhole it as "F# is a special language for like, scientists and stuff. Don't worry, it ain't got nothing on C#." And hey, with enough time and resources, C# may catch up on some of the things. With Rosyln, I think it'd be easier to make a C# WebSharper thing.

<comment><USER6> There are already a few approaches out there for compiling C# to JS, like my JSIL ([http://jsil.org/](http://jsil.org/)) and Script#'s unofficial successor, Saltarelle ([http://www.saltarelle- compiler.com/](http://www.saltarelle-compiler.com/)). I believe there is a new Roslyn-based C#->JS compiler in the works as well.

I'm not aware of anything that approaches WebSharper's level of integration, though. It's a really impressive piece of work.

<comment><USER3> Any idea why Microsoft isn't doing this as a first-class thing, instead of creating half-fixes like TypeScript?

</comment></comment></comment></comment><comment><USER7> Is this an arms length Jetbrains thing? If not, it seems awfully odd that its name is so close to Resharper and the parent company is called IntelliFactory, which is so close to IntelliJ. I guess there's nothing wrong with that. Just odd.

<comment><USER8> Ignoring, of course, that (a) they've probably used or heard of ReSharper and (b), both F# and C# pronounce the hash as "sharp"? ;-) I suppose it could be confusing but it wasn't the first thing I thought of...

</comment></comment><comment><USER3> WebSharper is really fantastic. F#'s a great language, and not having to leave it and deal with JavaScript is a great boon. So many problems simply disappear due to type checking.

<comment><USER9> I wanna knit that last sentence on a sweater for myself. Okay, maybe not, but I really liked it.

</comment></comment><comment><USER10> This looks very interesting in the same way as Clojurescript but with F# and potentially a smoother experience.

Has anyone used this that can provide some insight into it? Does it work with entity framework? OWIN? What's the story with the F# to javascript compilation; did they invent that or is it another project? Who are these people?

I think it's a shame that the C#/.NET ecosystem can't seem to have FOSS nice things because it really hampers stuff gaining traction. However I find the open source license for this is very clear and generous; I still can't seem to figure out if ServiceStack is safe to use :| This should allow for learning the framework and providing nice things to the community, and then the licensing seems reasonable compared to the value proposition for working on commercial software.

<comment><USER11> Perhaps worth mentioning, I recently saw a presenter say his company is moving away from Entity Framework in favor of F# type providers.

Agree on FOSS. It's nice this company will license to me for opensource projects, but what happens if they go out of business?

<comment><USER10> I'm not sure TBH, but most of their stuff is appears to be on github as well.

</comment></comment></comment><comment><USER12> I've been using WebSharper in production for 20 months now and I wouldn't consider doing web development any other way.

People have mentionned that such abstraction generally become more trouble then they are worth but I completely disagree.

In particular the question would be what are the corner cases that will make the abstraction more difficult to use and ruin your overall productivity and I haven't found anything so far.

What I find difficult though isn't creating wrappers around existing external javascript libraries but rather learning the quirks of each of them. For instance, I happen to maintain a WebSharper wrapper around the Kendo Web library (see here [https://github.com/davidgrenier/Kendo](https://github.com/davidgrenier/Kendo)) with the goal of abstracting away the complexity from my code base and where I spend most of my time is trying to figure out how to properly use any new control we've yet to use in production. This process is tedious and error prone because the examples on the Kendo website aren't exhaustive, the documentation isn't specific about the semantics of the library and just the brittle nature of javascript development. I spend lots of time in the chrome debugger and their online tool figuring out how things work. The productivity gain from isolating that from my code base is significant.

F# as a language is quite understated, more companies are using it than it seems (many of which in stealth mode) and so is the case for WebSharper. IntelliFactory has been selling licences to many of their closed-source clients, my employer being an example but also I'm aware that MSR uses it internally on a few projects and was told the developpers there love it. The fact that my employer continues to pay the licence, gives me work on the project and has recently hired another developer working full time with WebSharper indicates that they consider the value to be at least on par with everything else we do.

Over the 3+ years I've been using WebSharper, I've had to report only a single bug Monday of last week (see here [https://bitbucket.org/IntelliFactory/websharper/issue/288/sy...](https://bitbucket.org/IntelliFactory/websharper/issue/288/systemdatetimenow- on-ie8)) in the WebSharper core libraries related with compatibility issue in old version of IE and the bug was fixed within the week and had access to an updated WebSharper package from nuget.

WebSharper isn't just an F# to JavaScript compiler, they also offer powerful, paper-worthy abstractions to improve developer productivity:

-Transparent RPC calls from client to server (combined with static typing this is one of my preferred feature).

-Combinators for composing pages and managing routes in an elegant typesafe way.

-The ability to create standard server-side markup and yet SPA page building is even better as you get to pick what you carry over the wire and simply create all your markup on the client.

-Tools to create extensions around external javascript libraries (I've personally used WIG and works really well and I learned a few things about design while using it to boot).

-If you have access to Libraries that offer TypeScript bindings (like Kendo does) IntelliFactory can generate the wrappers for you.

-Tons of precreated wrapper for you to simply use

-Combinators to compose data/UI controls/event flow handling like Formlets/Piglets and now UI.Next which is excellent, I've come to appreciate all three and we're using Piglets in production though UI.Next should go a long way to allow you to do anything you need.

-Use existing abstractions in the standard F# development experience which would be hard to get otherwise (async workflows is an example).

I don't have strong opinions one way or another on licencing but as been mentionned before IntelliFactory generates revenues and as such I'd be skeptical of someone claiming that such and such model "doesn't work". Besides most of the concerns I've seen here seems philosophical rather than about direct impediments the licencing creates on what they had to do. Indeed the licencing cost my employer has to be is insignificant compared to the benefits and I personally do not pay for a licence on my own stuff.

Microsoft's position around the .NET ecosystem is sound, they provide the CLR, Base Library and a world class development environment. The rest is open to the community to drive the libraries/toolset they need, after all Microsoft can't do everything and it seems to me would tie in the community to Microsoft. You can see the latest open sourcing of the Roslyn compiler as a reflection of that. Likewise, the F# compiler service project and the direction taken by the F# Power Tools and the way Microsoft supports this initiative to enhance the VS development experience sends the same message. Speaking with Don Syme he indicated that technically there wouldn't be anything standing in the way of doing the equivalent of what IntelliFactory did with the new C# compiler, though you can be sure of two things: Microsoft won't be doing it and it's likely a tremendous amount of work.

I haven't played with any other similar toolset (ClojureScript/Purescript/GWT comes to mind) and as such I will not comment on those. But I will advise against listening to advice from anyone who hasn't used any of those specific libary. Even better, sit down and spend the time required to make it familiar and then you'll be a better judge.

If you are already using F#, I urge you to put 10-20 hours on it, you will thank yourself. If you aren't using F#, in my mind, WebSharper is just another wonderful reason to start doing so.

<comment><USER13> How leaky is the abstraction? Can you effectively use this with very little prior knowledge of front-end web development?

And what is the state of F# on Linux these days?

<comment><USER12> As all abstractions are leaky I have to concede that it has to be, but considering the size of the abstraction it's actually surprising how little gets in the way of getting things done (short of getting the hand of it for which the learning curve is far within that of WPF must have been for some people).

As far as as doing away with Web Development skill I would say no. As opposed to what ASP.NET used to do WebSharper doesn't try reinvent Web Development so one can "leverage" their existing Web Development skillset as opposed to have it superseded with something else.

On the other hand, being that I myself am a pretty bad web developer (despite of it being my official title), having static typing on a set of library that maps to HTML can really help (IntelliSense and simply preventing you from compiling something that wouldn't work). The other abstractions are just on top of everything else yet uses functions with the names you may be familiar with to produce markup.

Plus, I find that having functions as opposed to open and closing tags with the XML syntax is better on the eyes:

      Div [
        Span [Text "Hello"]
        Input [Type "Submit"]
      ]

as opposed to:

        Hello
        <input type="submit"></submit>

Another aspect is how easy it is to refactor blocks of markup away into function calls and use all existing F# functions over collections to programmatically produce content:

      [
        "David", "Grenier"
        "Anton", "T."
        "Loic, "D."
      ]
      |> List.map (fun (firstName, lastName) ->
         let lbl text = Label [Text text]
         LI [lbl firstName; lbl lastName]
      )
      |> UL

If you have a little imagination, you can see this can go a long way.

</comment></comment></comment><comment><USER14> I might be missing a point, but how is this different from tried-and-failed GWT?

Apart, obviously, in language of choice.

<comment><USER15> To be fair, F# vs. Java is more than a trivial difference.

<comment><USER16> Yes, the approach is a dead-end but the language is awesome.

</comment></comment></comment><comment><USER17> Wow this looks awesome. Always wanted to give F# a try, now I have no excuse!

</comment><comment><USER18> Another monolithic framework that will likely catch some unsuspecting CTO or director and ultimately be his demise, or someone who doesn't want to learn javascript (such people still exist, sadly).

<comment><USER19> Nobody really "wants" to learn JS. It's a hateful little language and the sooner it gets nuked from orbit or at least abstracted away to become merely the "assembly language of the web", the better.

While I don't agree WebSharper is monolithic - it's anything but that. I do agree that it is a bear trap. They could go bust at any moment and leave you with a big headache.

Even as a F# dev I have deliberately avoided using it because yes I agree with some of the sentiment here that the licensing model is a bit odd, but also the thought of needing to write a Binding for basically any JS library it doesn't support out of the box is quite a burden that will never go away. And can really slow down a new project that wants to iterate fast.

I firmly believe in using the best tools for the job at hand. So that means a F# back-end and a AngularJS front-end. It's a PITA maintaining two domain models in each, and similar validation logic etc, but such is life sometimes. What I lose in the domain model side, I gain back in a rich and vibrant set of available AngularJS modules and JS libraries.

</comment></comment><comment><USER20> That's interesting. I appear to have actually accidentally written a chunk of this in C# for a product a couple of years back. The approach is pretty much identical.

</comment><comment><USER21> Does anybody know what's the 2 chrome extensions displayed in the screenshot?

<comment><USER22> The first is "Google Hangouts" ([https://chrome.google.com/webstore/detail/hangouts/nckgahada...](https://chrome.google.com/webstore/detail/hangouts/nckgahadagoaajjgafhacjanaoiihapd?hl=en)), the second is "Awesome Screenshot" ([https://chrome.google.com/webstore/detail/awesome- screenshot...](https://chrome.google.com/webstore/detail/awesome-screenshot- captur/alelhddbbhepgpmgidjdcjakblofbmce?hl=en)).

</comment></comment><comment><USER23> This is everything I wish Script# could've been!

</comment><comment><USER24> what are the standard tools for working with databases with f# and websharper?

<comment><USER25> WebSharper is completely agnostic in this regard, so the question boils down to what is available for F#.

The idiomatic way to deal with databases is using one of the available type providers. Basically, a TP generates types at compile time, in a way that actually plays quite nicely with IntelliSense [1]. In the case of db TPs, they're parameterized by a connection string and connect to the db to extract the schema and generate the appropriate types. Several exist [2]; SqlDataConnection and SqlEntityConnection are built-in, FSharp.Data.SqlClient and FSharp.Data.SqlProvider are community contributed. They all use query expressions (basically, F#'s extensible version of LINQ syntax) except SqlClient which directly uses SQL in a string (but still checks the query at compile time and passes arguments cleanly, thanks to the TP) and is therefore more like a (safer) micro-ORM.

[1]: [http://msdn.microsoft.com/en- us/library/hh156509.aspx](http://msdn.microsoft.com/en- us/library/hh156509.aspx) [2]: [http://fsharp.org/guides/data- access/](http://fsharp.org/guides/data-access/)

</comment></comment><comment><USER26> The project is really great, however license is really bad. A modern framework, should be open source under liberal license. Licenses like this worked in 90s, but currently they don't work.

<comment><USER27> If you don't like the license, don't use the framework. It's that simple. Charging for commercial licenses for libraries is a perfectly valid business strategy, and I can see lots of F# developers paying for this.

<comment><USER28> >If you don't like the license, don't use the framework

That was the point, remember? Because of the terrible license, very few people will use it. So it will stay tiny and/or die out.

>and I can see lots of F# developers paying for this.

That's a non-sequitur. I pay for lots of free software. The problem is not cost, it is freedom.

<comment><USER29> You have the freedom to do _anything you want_ from the result of using this framework.

I also have the freedom to do so with what you make, if I am a user of it.

Why are you so dead set on taking away my freedom. Adding restrictions on what I can do with the work you created from that framework is kind of rude when the developers is asking you to share, and share alike.

<comment><USER28> >You have the freedom to do anything you want from the result of using this framework.

No I do not.

>I also have the freedom to do so with what you make

Then clearly I do not have the freedom to do anything I want.

>Why are you so dead set on taking away my freedom

I am taking nothing from you. I release all my code under the ISC license. That is free. Restrictions are not freedom.

>the developers is asking you to share, and share alike.

The developers can ask whatever they like. And I can decline their offer. I will continue to use free software instead. Why is it so upsetting that someone would choose not to use non-free software? If the developers find my absence to be a problem, they are welcome to change make their software free. I have no interest in shareware.

<comment><USER29> While I sincerely doubt that you release all your code under the ISC license, I will take your word on it.

That mean you can use any open source license and release your contributions under that license. Be that BSD, GPL, MIT, Apache... what ever it is, _your_ contributions can always be under the license of your choice.

So yes, you do have the freedom to do what _you_ claim _you_ only do, ie, release code you write under ISC license. 100% freedom to do exactly that. Write a addon to AGPL and release that add-on as ISC? No legal problem at all.

If you want freedom to release code someone else has written under the license of your choice, then I sit in the same boat. I would like too to have the freedom to chose that, but alas, copyright wont' allow that. It would be a neat freedom to chose the license of OS X and windows.

<comment><USER28> So, you have no idea what you are talking about, but you want to tell me both what I actually do, and what I should do? Gee, that's really compelling.</comment></comment></comment></comment></comment></comment></comment>


Coronavirus, Progression in Spain. (Grafana) - <AUTHOR> https://grafana.sysadm.es/d/Y9Anj9_Wz2dsadasDXCAxz5/coronavirus-spain?orgId=4&refresh=1h <comment><AUTHOR> Based on official data, and updated by volunteers. It shows the evolution by region.

Those countries that are still not suffering the health system collapse, shall learn from our mistakes. Hope the graphs display (one time more) the geometric nature of the emergency.</comment>


Microsoft, here's my offer - <AUTHOR> https://medium.com/i-m-h-o/80f979fdd692

<comment><USER2> How can someone say, "You own an operating system brand (Windows) that 91% of all computer owners in the world have installed on their system (June 2013). How is this not awesome?"

The customers do not even make the decision of buying Microsoft Windows operation system, but that is the only thing being sold to them alongside the Personal Computers they want. Personally I have pretty much only hate for Microsoft, but I can not argue if this statement is awesome when the statement is at least in my mind absolutely wrong.

<comment><USER3> _The customers do not even make the decision of buying Microsoft Windows operation system_

Oh pish posh - that's just not true, not in any way, shape, or form. If we're talking about "regular people" buying computers (mom, dad, etc), they absolutely choose Windows when they go to the "computer store", play around on a new PC, and walk out with it. How can you act as if they had no choice? The Apple Store opened almost a decade ago yet these people chose Windows as their OS instead. If we're talking "enterprise/company employees", it's likely that their base OS was pre-chosen for them but, that said, at some point a higher up IT person chose Windows because of Apple's choices 20+ years ago w/ respect to having servers and networking being first class citizens of the OS/environment.

You can hate MSFT all you want but to act as though, 91% of the time, people did not make a decision is just willfully ignorant or foolish.

<comment><USER2> Oh pish posh - maybe it is not completely true, but as far as I have seen it is.

The Apple versus Microsoft computer decision for regular people buying computers is more about the price of the computer than the operation system. If you ever go and work on the other side of the "computer store" you should see that most of the customers do come to buy a computer and not an operation system and often they do not even understand how powerful computer they need.

Of course there are those who have heard that Apple computers are good and buy Apple because of that, but those who do not have money for Apple computers do buy Microsoft computers because they do not have other choice at least here in Finland as we do not have any Linux or BSD computers on sale and probably never have had one on a regular home electronics store at least I have not seen.

It is also such a fiasco trying to sell Windows 8 computers when the customers who do not have money for Apple computers do not want Windows 8 because of the bad rumors which have gone really far and even beyond. They only decide to buy these Windows 8 computers because we do not have any Windows 7 computers on sale anymore and they are not ready to buy another operation system because they know someone on their family will pirate Windows 7. Those who do not know how to replace Windows 8 are stuck with it.

So where does a regular customer have the option to decide the operation system for the hardware they want in the store? There is only Microsoft until customer has enough cash to pay for Apple.

Oh boy I forgot about Chrome OS. It's cheap and people buy it because of the cheap price, but the return amount has been pretty damn high, because Chrome OS just can not do what those little more advanced computer users want like native gaming. Even the regular people want to install some game like diablo 2 on their system.

Of course in enterprise the decision is done, because these IT persons do know the options exists, but regular customers usually do not.

I am saying that the decision for customer to select different operation systems has been made for them for quite some time by the computer manufacturers.

</comment></comment></comment><comment><USER4> The experience with multiple accounts and having to cancel via support to avoid a credit card charge also happened to me.

His list, especially the multiple accounts issue, makes Microsoft sound like a government, in the worst way. It's a good thing they don't have weapons.

<comment><AUTHOR> My list was just a set of random things that popped up while I was typing, there is so much more where this came from. I wonder how big it would get if we would setup and collect all of it. Like, have a startup that just focuses on collecting hate and redistributing it to quality programs in these enterprises.</comment></comment>


No evidence of clinical efficacy of hydroxychloroquine in Covid-19 Patients [pdf] - <AUTHOR> https://www.medrxiv.org/content/10.1101/2020.04.10.20060699v1.full.pdf <comment><USER2> Actual title "No evidence of clinical efficacy of hydroxychloroquine in patients hospitalised for COVID-19 infection and requiring oxygen:..."

from the article:

"181 patients with SARS-CoV-2 pneumonia..."

These patients had pneumonia and were infected with Covid-19 for days prior.

Its too late for the hydroxychloroquine to stop the Covid-19 virus. The disease has progressed to its second phase wherein the virus and other opportunistic pathogens (e.g., bacteria) attack the lungs and other tissue. Antibiotics may help but these patients arrived too late at the hospital to gain the full efficacy of hydroxychloroquine, which when coupled with zinc sulfate, slows or halts the viral replication.

<comment><USER3> Yes, that was my immediate take on the paper. However, the jury is still out if you take HCQ after the onset of sympthoms if that is also too late.

Based on this in-vitro study - [https://www.nature.com/articles/s41421-020-0156-0](https://www.nature.com/articles/s41421-020-0156-0) \- if I hypothetically had both Chloroquine (CQ) and Hydroxychloroquine (HCQ), I would prefer HCQ for prophylaxis, but if I was exposed and likely infected or developed sympthoms, I would choose CQ. The loading time or HCQ is longer and it appears less effective at higher MOIs "the data suggest that the anti- SARS-CoV-2 activity of HCQ seems to be less potent compared to CQ, at least at certain MOIs."

</comment></comment><comment><USER4> Dupe [https://news.ycombinator.com/item?id=22879361](https://news.ycombinator.com/item?id=22879361)</comment>