News for hackers. Stuff that matters.
Re:Fable 3: F# to JavaScript compiler by adamnemecek on Friday December 04, 2020 @01:37PM (#25305967)
I have been intrigued by the SAFE stack lately https://safe-stack.github.io/. Does anyone have direct experience with it?
Re:Fable 3: F# to JavaScript compiler by rishav_sharan on Friday December 04, 2020 @02:30PM (#25306602)
Not SAFE, but there's a new web framework for f# at https://www.falcoframework.com/. It's in functional first approach and built on top of asp .net

I have only done some toy projects on it so far, but am really digging it.

Re:Fable 3: F# to JavaScript compiler by JaggerJo on Friday December 04, 2020 @01:49PM (#25306114)
Yep.

We’re using F# React on the front-end, Giraffe on the back-end.

DustyTables for Data Access.

It’s great - can recommend.

Re:Fable 3: F# to JavaScript compiler by tartoran on Friday December 04, 2020 @01:56PM (#25306201)
Is the market for F# picking up now in 2020? At my current job we're not using F# but I'd like to eventually move to a place that does. I am learning on my own at the moment and am wondering how open the potential hiring companies would be with novices in F# who otherwise have good experience in other languages.
Re:Fable 3: F# to JavaScript compiler by JaggerJo on Friday December 04, 2020 @02:02PM (#25306283)
From my experience it’s still not easy to find an F# Job.

It’s a niche, but it exists and is growing.

If you want one and are willing to take a few compromises you’ll find one.

Re:Fable 3: F# to JavaScript compiler by nextos on Friday December 04, 2020 @04:11PM (#25308052)
I see a decent number of openings in the City of London quite regularly for finance and insurance positions. Also OCaml and sometimes Haskell. Even Rust has started popping up recently.

I find this a bit intriguing because the library support for linear algebra, probability and statistics is pretty slim both in .NET and OCaml. The latter has OWL, which is very cool, but it's mostly a 1-person project.

Do they develop all this support in house? For example, in insurance you may need things like Gumbel or Fréchet maximum likelihood estimators. That's not so easy to implement on your own, especially not without some linear algebra and optimization primitives available.

On the other hand, I love these languages, and I wish there was a strongly typed contender to Python, R or Julia. Whenever I develop a data-oriented application, it feels like I need to prototype in one language and in order to scale or develop the whole infrastructure, I need to switch to another language.

Julia has solved some of these problems, but I don't see a team implementing tons of business logic in a medium sized application using Julia.

Re:Fable 3: F# to JavaScript compiler by pjmlp on Friday December 04, 2020 @05:39PM (#25309256)
Usually on the .NET ecosystem such stuff just gets bought.

https://www.quantconnect.com/blog/top-numerical-libraries-fo...

Re:Fable 3: F# to JavaScript compiler by KurtMueller on Friday December 04, 2020 @06:25PM (#25309684)
F# is your strongly typed contender to Python.
Re:Fable 3: F# to JavaScript compiler by nextos on Friday December 04, 2020 @06:30PM (#25309721)
Sure, it's a lovely language. But I find the lack of some basic linear algebra, probability and statistics libraries frustrating. As pjmlp said in a parent thread, those are closed source and usually bought.

I guess a lot of the .NET ecosystem is like that. It's a shame, because MS has some open-source jewels like Z3 or Infer.NET.

Re:Fable 3: F# to JavaScript compiler by mdm12 on Friday December 04, 2020 @08:25PM (#25310689)
MS is making a conscious effort to push into the ML space with libraries such as ML.NET https://dotnet.microsoft.com/apps/machinelearning-ai/ml-dotn... . IMO, the combination of a strongly-typed language with features such as type inference, data providers and discriminated unions/pattern matching make F# a perfect fit for this space. It's just unfortunate that they had to go through the .NET Framework -> .NET Core journey before focusing on the ML ecosystem...

But, the F# PM has recently given talks recognizing that they want to go into the space that Python is dominating, so it's a clear goal of the F# team (https://www.youtube.com/watch?v=_QnbV6CAWXc). I hope they're successful!

Re:Fable 3: F# to JavaScript compiler by pjmlp on Saturday December 05, 2020 @03:04AM (#25312744)
On the other hand, they just hired Guido, have first class support for Python across VS and VSCode, and are in the process of creating a Python projection for UWP (which still doesn't support F#).

From the outside it always looks like an uphill battle for F#.

It would be great if F# finally gets its place across the .NET stack.

Re:Fable 3: F# to JavaScript compiler by nbevans on Saturday December 05, 2020 @03:59AM (#25312947)
Odd. I've been using F# for a UWP app since 2018.
Re:Fable 3: F# to JavaScript compiler by pjmlp on Saturday December 05, 2020 @04:07AM (#25312978)
Odd indeed, given that .NET Native doesn't support it without a couple of hacks.

https://github.com/dotnet/corert/issues/5780

https://github.com/dotnet/fsharp/issues/1096

Re:Fable 3: F# to JavaScript compiler by nbevans on Saturday December 05, 2020 @04:18AM (#25313036)
As per those links - the workarounds found in 2018 allow you to submit to Windows Store.

But even still - my app is sideloaded and never needed to care about .NET Native at all.

Re:Fable 3: F# to JavaScript compiler by pjmlp on Saturday December 05, 2020 @04:40AM (#25313139)
Workarounds are not official support and won't fly for many customers deciding what to place in production when picking technology stacks, so the choice ends up being C#, VB, C++, Rust, JavaScript and Python.

The official set of programming languages getting UWP support as part of Project Reunion.

Re:Fable 3: F# to JavaScript compiler by nbevans on Saturday December 05, 2020 @05:03AM (#25313244)
WinUI / Project Reunion is just a continuation of the UAP (Universal App Platform) libraries. The support for C# works for F# - just like basically any other C# library can be used from F#. I figure the reason they don't mention F# is because it is obvious and/or implied but perhaps at the same time don't want to infer there is some kind of F#/FP-style syntax.

I wouldn't confuse Project Reunion and the arbitrary Windows Store requirement that apps be compiled with .NET Native. A requirement that, frankly, is on borrowed time anyway and I can't envisage it surviving much longer. Once .NET 6 delivers Mono-style AOT support - .NET Native's sole remaining purpose will cease to exist. Not that modern hardware ever needed it. It was intended for Windows Phones.

If the choice facing us was a simple as you describe then, for example, we wouldn't have ended up building a UWP app in F# back in 2018, would we? Not everything is black and white nor zero sum.

Re:Fable 3: F# to JavaScript compiler by pjmlp on Saturday December 05, 2020 @06:51AM (#25313866)
Good luck with that reasoning when Windows 10X comes out next year.

UWP is still the future of Windows API, Reunion is only lifting it from the Windows kernel, and exposing the respective COM infrastructure on the Win32 side as well.

When I create applications for customers I don't select technologies that require me to place workarounds that might make them repent for having me there in first place.

Hence why as much as I like F#, it is never going to be an option for me, until it has a seat at the table of the official languages.

Apparently that isn't an issue in your case, so good luck with the endeavours.

Re:Fable 3: F# to JavaScript compiler by nbevans on Saturday December 05, 2020 @07:25AM (#25314033)
There is nothing concerning Windows 10X that undermines anything I have said.

UWP is the future of Windows - correct.

I'm not sure any significant part of UWP has ever been in the kernel per se.

It sounds like you're a consultant where taking risks on behalf of your customers, no matter how small or logical the risk, is obviously not part of your job description.

Your offerings of good luck appear to be disingenuous.

Re:Fable 3: F# to JavaScript compiler by nbevans on Saturday December 05, 2020 @08:33AM (#25314423)
We've been running F# in production since 2014 - almost 7 years. It is quite shocking to hear anyone imply that F# is not ready for production use - that it is just "cool" tech. (when has F# ever been cool in the minds of the masses?)

I suspect you'll say "7 years is nothing" and maybe it is nothing. But it is still something. It is long enough that we made a couple bad framework/library dependency choices early on and to have learnt lessons from such mistakes.

By far the biggest technical challenge we've faced in that time is the .NET 5 migration - but even that might turn out to be a lot easier than I currently envisage.

Re:Fable 3: F# to JavaScript compiler by pjmlp on Saturday December 05, 2020 @08:37AM (#25314454)
On the context of Windows GUI frameworks and UWP, no it isn't ready.

Still no VS or Blend tooling support, no project templates and .NET Native requires workarounds with stuff that most corporate enterprise developers don't care to learn.

Re:Fable 3: F# to JavaScript compiler by pjmlp on Saturday December 05, 2020 @07:54AM (#25314180)
Picking F# over official supported languages has zero value on the sales of customers, that is what they care about, not cool software stacks.

So if their IT goes down and the reason is that a risky loving consultant used unofficial workarounds, I rather not get unnecessary phone calls.

As for the wishing luck, I was being honest, take it as you wish.

Re:Fable 3: F# to JavaScript compiler by KurtMueller on Friday December 04, 2020 @07:17PM (#25310182)
Hopefully F# gets big enough that people will write those libraries - I think people deserve a better Python.
Re:Fable 3: F# to JavaScript compiler by Paradigma11 on Saturday December 05, 2020 @06:19AM (#25313657)
Interesting in the ML space is https://diffsharp.github.io/ which is heavily developed by Don Syme at the moment.
Re:Fable 3: F# to JavaScript compiler by Scuds on Friday December 04, 2020 @03:13PM (#25307150)
this is part of the greater lament of FP languages in industry. You might have to be satisfied with a kind of FP flavored C#, which in newer versions of the language isn't all that bad The thinking is that there's a million C# devs, a hundred thousand VB devs, and ten thousand F# devs.

If you want to work in F# come up with your own OSS projects or champion it at work.

Re:Fable 3: F# to JavaScript compiler by merb on Friday December 04, 2020 @02:22PM (#25306508)
what about efcore does it work in f#? or is it bad practice to use mutable code/objects in f#? i do not want to go back to plain sql...
Re:Fable 3: F# to JavaScript compiler by JaggerJo on Friday December 04, 2020 @02:38PM (#25306694)
It’s a .Net library so it works (or should work) with F#.

What sometimes leads to problems is F#’s record and discriminated union types.

Not sure how they are handled by EF Core.

Going back to plain SQL is just great. You know exactly what SQL gets executed. No Magic.

With DustyTables it’s also not too much boilerplate.

Re:Fable 3: F# to JavaScript compiler by banashark on Friday December 04, 2020 @03:19PM (#25307261)
Design-time support is still via a non-released package. So you'll write models/etc in C# and use EF from F#. There are ways to get design-time constructs working in F#, but it's not plug-and-play like from the C# side.
Re:Fable 3: F# to JavaScript compiler by angio on Friday December 04, 2020 @03:23PM (#25307315)
You can write models in F# (with CLIMutables everywhere), but then you need to put models in a separate project, then add a C# project for migrations, and finally reference both projects from your ASP.NET app.
Re:Fable 3: F# to JavaScript compiler by ben509 on Friday December 04, 2020 @03:44PM (#25307656)
Apparently C# 7 can match discriminated unions quite well[1], with the caveats being:

1. you need a dummy type[2] for empty parts of the union.

2. it still can't enforce exhaustive matching.

[1]: https://stu.dev/pattern-matching-fsharp-union-types-in-cshar...

[2]: Maybe () would work?

Re:Fable 3: F# to JavaScript compiler by dfgdghdf on Friday December 04, 2020 @06:50PM (#25309905)
I am not using SAFE, but something similar:

* Suave

* AWS

* Fable

* React

SAFR? It's great, but missing a snazzy acronym.

Re:Fable 3: F# to JavaScript compiler by troughway on Friday December 04, 2020 @02:03PM (#25306292)
For those too lazy to hunt, SAFE stands for

Saturn

Azure App Service

Fable

Elmish

Slightly off topic but it’s good to see that F# is finally getting some proper web love.