Fable F#-to-JavaScript tool integrates with Microsoft .Net Core SDK

Fable uses the Babel compiler to make JavaScript a back end for Microsoft’s F# functional programming language

Fable, a compiler that enables Microsoft’s F# “functional first” programming language to emit JavaScript, has reached a 1.0 beta stage, featuring integration with Microsoft’s .Net Core SDK.

Leveraging the Babel JavaScript compiler, Fable makes JavaScript a back end for F# without having to compile to .Net bytecode. The beta release has .Net Core serving as an open source implementation of .Net for Windows, Linux, and Mac.

“Also, as Fable 1.0 relies on the new F# project format, we may wait until it is supported in Visual Studio 2017 — currently the new .fsproj is only supported in Ionide — but hopefully that will take only a few weeks,” said Alfonso Garcia-Cano, Fable’s lead developer.

The beta release also features an improved approach to project files. Developers will see a list of files, references, and CLI tools that can be easily edited without fear of breaking anything in a build, according to Garcia-Cano. The .Net Core SDK accepts references for CLI tools, and with a project file running “dotnet restore,” developers can run Fable commands, prefixed with “dotnet fable.”

In Fable 1.0, curried lambdas are no longer compiled as nested functions. This situation had caused confusion and forced users to convert the lambdas into delegates before sending them to JavaScript. Instead, the 1.0 version has the compiler detecting whenever more or fewer arguments than expected are being applied to a function, with a nested function created ad hoc if necessary. If this guess is too difficult, Fable will create a dynamic lambda to check the number of applied arguments in runtime.

Also with the beta release, Fable’s integration with Webpack means there will only be one configuration file and better interaction with languages like JavaScript or TypeScript. While it might seem risky to tie Fable to Webpack, most users already have been using it, Garcia-Cano said.

source computerworld

0 0 votes
Article Rating
Notify of
Inline Feedbacks
View all comments
Would love your thoughts, please comment.x
Scroll to Top