Fable: Functional programming in F# meets JavaScript

Fable is a new compiler for F# to JavaScript, mainly developed by Alfonso Garcia-Caro.

Fable makes it possible to use functional-first programming with F# to produce clean JavaScript code with static type checking, IntelliSense and all the other advantages of the F# compiler and common F# code editors.

Getting started

It is actually fairly easy to get started with e.g. developing client-side browser applications even without a lot of experience with Node.js and the JavaScript ecosystem. For an introductory tutorial please refer to Getting started with Fable and Webpack

Fable also supports development of client-server, Node, mobile or desktop applications.

Sample

Here is a little sample. I did an implementation of SameGame, the famous tile-matching puzzle:

width

height

colors

select game

0 point(s).

How does it work?

For more information on the implementation details, please refer to the samples page of the Fable web site or view the source code on GitHub.


The header image “Pegasus” by Pearson Scott Foresman has been released into the public domain. The picture was modified to fit this article.

Published by

Leif Battermann

I am a passionate software developer interested in .NET C#, F#, Haskell, software design and architecture, functional programming, clean code, flow design, code katas, coding dojos and more.