Live data from Hacker News

Fable 3: F# to JavaScript compiler

fable.io

81–90 of 131 posts

Re: Fable 3: F# to JavaScript compiler

#81

This looks like a great update: prettier code output plus roughly double the compilation speed. Compilation speed is one of the things that put me off Fable when I kicked the tires a while ago. That and tooling was a mess. I really like F# as a language, but it's hard to give up the high quality tooling of VS Code + TypeScript + almost any NPM package w/ proper types.

> it's hard to give up the high quality tooling of VS Code + TypeScript + almost any NPM package w/ proper types.

This is my gripe exactly. If you gave me Svelte# and we'd be talking (my TS is pretty functional otherwise).

Re: Fable 3: F# to JavaScript compiler

#82
post #66

Earlier quoted context omitted.

Amazing! I’d be interested- the problem I have in the FP space is not getting the F# or Haskell experience so you have to “keep up in your spare time” and with other commitments I have to choose what to keep up with and the rarity of FP jobs means it makes more sense to say learn Redux, Sagas, that kind of stuff etc. So I think it’s good if companies like yours would take pure enthusiasm with proven knowledge of othe…

I find the same thing. Getting the experience can only happen in time I direct. I have scope to use F# at work but still fear that choice is not the best for the company I work for. Yes I will love the tooling and right now I'm there but it won't always be that way. They won't be able to find contractors to make changes in the future. I have to give them solutions they can run with in the future or they will be forev…

If you're on a .NET stack, F# is a secret sauce; its just not many have bothered to look :) Maybe discuss with your CTO and make a collective decision to invest in it by understanding what it brings to the table, and don't worry too much about the future, like having to hire F# devs. As I described above, guiding existing devs to learn F# is the equivalent of training them to think better (as PG/Eric Raymond quote, it will "make you a better programmer for the rest of your days"). If a small handful of you within the company develop expertise, you can guide others. And what's more; if you do pick up F#, many skills are transferable to other FP jobs (like Scala). There's a leap-of-faith element involved, but it has been paying us dividends.

Also, I really like this post: https://fsharpforfunandprofit.com/posts/low-risk-ways-to-use...

Re: Fable 3: F# to JavaScript compiler

#83
post #48

We're an F#-first company and I'd like to share our experience here. All our new code is in F#, we started off from a C# codebase, so that made the transition somewhat manageable, as new F# code can be directly called from C#, and vice versa (still took over 2 years). All new frontend apps are also being written in F# (using Fable), as of 6 months back, migrating away from TypeScript, this forces everyone into a "des…

Maybe it's my unsophisticated mind talking here, but programming in F# is pure joy.Among the languages I use only Ruby gets close to provide that feeling.

Yes :) That moment when it simply clicks, it's not something that goes away. It has certainly made my day-to-day programming work a lot sweeter, hence I can't shut up talking about it. And it's not like I write some esoteric ML or data science code, a lot of these are boring line-of-business applications, yet it is so satisfying designing those in F#.

Re: Fable 3: F# to JavaScript compiler

#84
post #48

We're an F#-first company and I'd like to share our experience here. All our new code is in F#, we started off from a C# codebase, so that made the transition somewhat manageable, as new F# code can be directly called from C#, and vice versa (still took over 2 years). All new frontend apps are also being written in F# (using Fable), as of 6 months back, migrating away from TypeScript, this forces everyone into a "des…

Please can you sure more about this? > We also make ample use of quotations to do some cool tricks (like predict the future states some type can take, based on current state + available transitions).

Here's is a simplistic example of a state machine:

  let transition (state: State) (action: Action) : State option =
     match (state, action) with
     | (StateA, ActionA) -> Some StateB
     | (StateA, ActionB) -> Some StateC
     | (StateB, ActionA) -> Some StateB
     | _ -> None
If you get the quoted representation of the transition function, it can be visualized as a tree data structure (like code-as-data in LISP). You can analyze that tree to understand that if current state is StateB, only ActionA can be applied on it.

Couple this with another realization: "Any sufficiently complicated model class contains an ad hoc, informally specified, bug-ridden, slow implementation of half of a state machine." (not sure where I read this quote).

This means all the entity framework/ORM crap work that we do can actually be neatly represented as transforms on a F# state machine, which suddenly makes the application more powerful if you give it this structure.

We use this technique to auto-generate admin panels.

Re: Fable 3: F# to JavaScript compiler

#85
post #39

Earlier quoted context omitted.

Still ready for production.

Elm is definitely not ready for production, hostile compiler maintainers.

I use it in production and I recognize your username because you always appear when the topic of Elm comes up on HN so you can write the same exact comment.

https://news.ycombinator.com/item?id=22237578 (I wrote this exact comment about you 10 months ago on another F# + JS submission)

If this is going to be your hobby horse, why not put some effort into it beyond "lol sux"?

Re: Fable 3: F# to JavaScript compiler

#86
post #83

Earlier quoted context omitted.

Maybe it's my unsophisticated mind talking here, but programming in F# is pure joy.Among the languages I use only Ruby gets close to provide that feeling.

Yes :) That moment when it simply clicks, it's not something that goes away. It has certainly made my day-to-day programming work a lot sweeter, hence I can't shut up talking about it. And it's not like I write some esoteric ML or data science code, a lot of these are boring line-of-business applications, yet it is so satisfying designing those in F#.

Does interop with c# get easier?

Trying to figure out how to map to an overloaded C# callback (maybe hidden in an *.extension doc!) has wasted hours of my time.

F# (the ml family in general) is my favorite language right now but, man, the .net APIs are rough.

Lacking the same UX I’m used to in Node, Ruby, and Elixir.

Re: Fable 3: F# to JavaScript compiler

#87
post #86
post #83

Earlier quoted context omitted.

Yes :) That moment when it simply clicks, it's not something that goes away. It has certainly made my day-to-day programming work a lot sweeter, hence I can't shut up talking about it. And it's not like I write some esoteric ML or data science code, a lot of these are boring line-of-business applications, yet it is so satisfying designing those in F#.

Does interop with c# get easier? Trying to figure out how to map to an overloaded C# callback (maybe hidden in an *.extension doc!) has wasted hours of my time. F# (the ml family in general) is my favorite language right now but, man, the .net APIs are rough. Lacking the same UX I’m used to in Node, Ruby, and Elixir.

Interop is janky. It works, but there are some gotchas that need to be worked around. It works in 95% of the cases without much mucking around, but it's not pretty, so you're better off tucking that away in some dark corner.

Re: Fable 3: F# to JavaScript compiler

#88
post #68
post #53

Earlier quoted context omitted.

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.

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 j…

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

#89
post #80

Earlier quoted context omitted.

I think you are missing the biggest advantage of F#: computation expressions. Computation expressions are like do-notation and list comprehensions in one feature. Now that I have tried them, I don't want to go back to a language without!

This is just monadic bind, every functional language has this

F# computation expressions go well beyond notation for monadic bind, see the section in https://fsharp.org/history or other technical descriptions.

Re: Fable 3: F# to JavaScript compiler

#90
post #86
post #83

Earlier quoted context omitted.

Yes :) That moment when it simply clicks, it's not something that goes away. It has certainly made my day-to-day programming work a lot sweeter, hence I can't shut up talking about it. And it's not like I write some esoteric ML or data science code, a lot of these are boring line-of-business applications, yet it is so satisfying designing those in F#.

Does interop with c# get easier? Trying to figure out how to map to an overloaded C# callback (maybe hidden in an *.extension doc!) has wasted hours of my time. F# (the ml family in general) is my favorite language right now but, man, the .net APIs are rough. Lacking the same UX I’m used to in Node, Ruby, and Elixir.

Can you explain the interop a bit more? I’ve been looking into an F# job. Having a functional background, the language looks nice, but I’m wondering about the ecosystem. Can you not use .Net libraries as easily as you can from C#?
Post reply on HN