Dynamically extending F# applications

Dynamically extending F# applications

Introduction

Changing requirements, introducing different data format, extending applications with new features. All those things requires us (developers) to go to code, do changes, add API versioning system (to be backward compatible), add configuration for turning on/off new features, compile application, and at the end release new application (what itself may be complex process). It’s often lot of work required for every, even very small, change.

In this post I’ll present way to add new features to our F# application - dynamically, on runtime, without any recompiling and redeployment of application. What’s more extensions will be also defined using F#… in fact they will be simple F# script files.

read more

Working with F# projects in VSCode

Working with F# projects in VSCode

Introduction

Visual Studio Code is a lightweight but powerful source code editor which runs on your desktop and is available for Windows, OS X and Linux. It comes with built-in support for JavaScript, TypeScript and Node.js and has a rich ecosystem of extensions for other languages (C++, C#, Python, PHP) and runtimes. The F# support for VSCode is provided by Ionide - set of extensions adding F# support, as well as Paket and FAKE.

If you’re new VSCode user installing extensions is pretty easy - press extensions button on left panel, search for Ionide, press install for all Ionide extensions, wait untill all are installed and restart VSCode.

Ionide-FSharp provides wide set of features useful for F# developer - from simple autocomplete and tooltips, through F# Interactive integration, to navigating to symbols or finding all usages of symbol.

It also comes with decent support for F# projects (defined using .fsproj file).

read more

Creating custom project file for F#

Creating custom project file for F#

Introduction

Let’s imagine a world where F# is independent language, with cross-platform tooling making life of every F# developer easier. In this world, after we’ve fixed dependency management problem with Paket, we could go one step further… and fix project file format and building. We would use same principles as Paket - very simple, human readable, file format which can be edited without any other tooling, and command line tool responsible for building such project.

In such world I’ve decided to create new open-source project called Chris

File format

For our hypothetical project file (called project.chris) I’ve decided to use toml. In this very simple file we would just specify few properties, files of our project, GAC references and external NuGet packages. It would look like as follows:

[Info]
Name = "Fancy_Test_Project"
Author = "Lambda Factory"
Git = ""

[Stuff]
References = ["mscorlib", "System", "System.Core", "System.Numerics"]
Files = ["Message.fs", "Test.fs"]
Packages = []

read more

Getting started with Fable and Webpack

Getting started with Fable and Webpack

Introduction

Fable is new F# to JavaScript compiler created by Alfonso Garcia-Caro. In this post I’ll go, step by step, through process of creating client-side (browser) applications using it.

This post is targeted at F# developers without lot of knowladge about Node.js and JS ecosystem and it should let any F# developer to get started with Fable.

Requirements

Fable requires having both F# 4 and node 4.4 or bigger installed in your computer.

read more

Creating VS Code plugins with F# and Fable

Creating VS Code plugins with F# and Fable

Introduction

EDIT 22.03.2016 Thanks to Alfonso’s help I was able to remove postbuild step fixing JS.

VS Code is new text editor (or rather lightweight IDE) created by Microsoft. Because it is product based on Electron - cross platform engine allowing developers to write desktop applications using web technologies - its plugin system supports JavaScript (and TypeScript). Unfortunately both those languages are not nice choice for someone using statically typed functional programming languages like F#. Up to this moment in my VS Code extensions I was using F# library called FunScript which compiles F# code to JavaScript. Whereas it sounds nice, library has some problems which makes writing code using it not nice experience. Fortunately recently, Alfonso Garcia-Caro, one of contributors to FunScript, has decided to create new project compiling F# to JS (with Babel as middle step) called Fable which hopefully will solve some of the FunScript’s problems. I have decided to investigate how this new library can be used to create VS Code plugins… using VS Code to code and compile those plugins.

read more