FunScript: Using the Power of F# for Writing Web Apps
FunScript is an F# compiler library enabling developers to write single-page web applications in F# and running them in the browser or on the server via Node.js.
A sample “Hello, World” example written in FunScript looks like this:
type lib = Api<"lib.d.ts">
let hello () = lib.window.alert("Hello, World!")
Each module is saved in a “.fs” file and it must be annotated with the FunScript.JS attribute. The page’s DOM is accessed via the type
lib. The last line is used to start the launcher. The module is stored on a simple web server by default.
Another advantage of using FunScript for web applications is the ability to use F#’s generics and asynchronous programming capabilities. Also, the developer can work with JSON data and REST APIs using F# 3.0 type providers. All of that while maintaining F#’s conciseness.
FunScript is an open source project licensed under Apache License 2.0
Edmund Jorgensen Nov 27, 2014
Lisa Adkins and Michael Spayd Nov 27, 2014