Live data from Hacker News

A new F# compiler feature: graph-based type-checking

devblogs.microsoft.com

11–20 of 118 posts

Re: A new F# compiler feature: graph-based type-checking

#11

Can anyone recommend a good hard copy book for F#? One that covers the syntax, language features, and covers functional programming fundamentals along the way? Like, the F# book that Brian Kernighan would write?

I would recommend two. F# in Action [1] by Isaac Abraham is a great (and recent) introduction to the F# language. For a more philosophical, domain-oriented book, you can't go wrong with Scott Wlaschin's Domain Modeling Made Functional book[2]. Scott's blog[3] is also must-read material.

[1] https://www.manning.com/books/f-sharp-in-action

[2] https://pragprog.com/titles/swdddf/domain-modeling-made-func...

[3] https://fsharpforfunandprofit.com/

Re: A new F# compiler feature: graph-based type-checking

#13
post #8

Btw. building GUI apps is super simple in F#. (mac, linux, windows, ios, android, web) https://github.com/fsprojects/Avalonia.FuncUI

Also Fable is pretty cool https://fable.io/

Here build times are not really an issue as it seems to be hot-transpiling to js, so save and site is reloaded almost instant (at least small sites):

My small tools site built with Fable: https://peheje.github.io/compare.html

If you look at the JS - that's of-course the production minimized build, the transpiled JS is pretty nice and readable.

Super simple site - vanilla JS seems wonderfully easy with F#, easy to hide its warts and build easy re-usable items.

But there's of course also smarter stuff with two-way bindings via html annotation and builders etc. I am actually using Feliz.ViewEngine, which is building the HTML using F#, but only for the navigation bar. Might try converting a page to it.

Re: A new F# compiler feature: graph-based type-checking

#15
This is very neat, I love the idea of using the syntax tree to guide what can be parallelized vs. not.

As some additional background, there's a very good reason why the F# language typechecks files sequentially. Because F# supports type inference at every scope, a single change in the body of a function can result in cascading type changes across an entire project. This kind of change can not only affect other files, but other files inside of other projects in the same solution.

A way to curb these kinds of cascading changes is explicit type annotations and/or signature files, which "lock" the type signature for a given construct/file. And the F# compiler has had optimizations in place when signature files are used to know when to re-check stuff based on this. However, these didn't extend to the sequential typechecking of files, and for the large majority of codebases that don't use signature files, these optimizations didn't really kick in anyways.

Re: A new F# compiler feature: graph-based type-checking

#16
Great addition to a great language.

We've been building a very technical product in F# + Rust for the last three years or so (think R lang + R Studio or Replit but for DSLs we built for finance and contracts).

While most folks tend to see F# as a .NET-oriented/back-end kind of language, they'd be missing some incredibly unique web technologies such as the Fable compiler (F# -> JS, Python, Dart, etc) and Elmish (Elm, but for F# with a JS target via Fable). It boggles my mind that more of the web dev community haven't discovered these tools.

These "communities" fall completely outside of MSFT's umbrella, but are transformative for how you think about architecting applications: Elm as an architecture (rather than as a language) enables a large amount of optionality in terms of what technologies one might use as a "reactivity layer" (e.g. can swap out React for SolidJS or even non-JS targets like Avalonia quite easily if it made sense to).

Our bet is that it enables us to future proof things in a number of unique ways as better WASM-based solutions come online as well that hopefully won't require shipping the whole .NET runtime (e.g. Bolero). The approach is also v helpful in managing state across an otherwise very complex application.

Re: A new F# compiler feature: graph-based type-checking

#17
post #2

Great, now how about Microsoft stop treating F# like a redheaded stepchild? 99.999% of .NET shops will not touch it.

Statistically, functional languages _are_ redheaded stepchildren.

While f# is definitely founded in functional paradigm. I feel like it's more a universal language.

Like Kathleen says in her intro to f#6

https://youtu.be/jOrgDoMuFog?si=Dnu8kPPi5QS5rNOR

"Im gonna do cool stuff like fold this unfold that. Dom said. Why don't you just write code?" (Paraphrasing it's first of the video)

Re: A new F# compiler feature: graph-based type-checking

#18
post #16

Great addition to a great language. We've been building a very technical product in F# + Rust for the last three years or so (think R lang + R Studio or Replit but for DSLs we built for finance and contracts). While most folks tend to see F# as a .NET-oriented/back-end kind of language, they'd be missing some incredibly unique web technologies such as the Fable compiler (F# -> JS, Python, Dart, etc) and Elmish (Elm,…

this sounds exciting, but I wonder. How closely linked is Elmish to Elm?

In theory Elm is just such a fascinating project... if it was not held back by the people developing it.

Re: A new F# compiler feature: graph-based type-checking

#19

F# is so good, such a shame so few companies use it. I have to touch C# and it's always a little bit painful after a few weeks of F# work.

F# is my go-to language for new backend projects and console apps. You can be as functional as you like, with imperative/mutable/OOP escape hatches available for those rare but unavoidable times you need them

Re: A new F# compiler feature: graph-based type-checking

#20
post #8

Btw. building GUI apps is super simple in F#. (mac, linux, windows, ios, android, web) https://github.com/fsprojects/Avalonia.FuncUI

I did a project using Avalonia.FuncUI a few years ago, and would highly recommend it. It made GUI development fun again.
Post reply on HN