Last month after I wrote a small prototype to get the F# Suave.io web framework running on Azure Web Apps (a git deployed managed Platform as a Service) I started looking for more F# Azure resources.
Here's a list of some other existing F# programming technologies that are great with Azure. Did I miss any? I surely did. There's a huge list up at FSharp.org for resources running F# on any cloud.
- Fog (an F# Azure data scripting API)
- MBrace (a scalable distributed programming model for F#)
- FSharp.Data (a set of F# type providers for common cloud data manipulation scenarios)
- Suave (a simple web development F# library for lightweight microservicesincluding route flow and task composition)
- FSharp.CloudAgent - a simple framework to easily distribute workloads over the cloud whilst using standard F# Agents as the processing mechanism. Support exists for both simple and reliable messaging via Azure Service Bus, and for both workers and actors.
- AzureStorageTypeProvider - An F# Azure Type Provider which can be used to explore Blob, Table and Queue Azure Storage assets and easily apply CRUD operations on them
- Try F# - A web programming console for F# that can be reoriented towards Azure programmability
- HadoopFs - A lightweight F# implementation of the Hadoop Streaming API
- FSharp.Azure - A wrapper over WindowsAzure.Store using idiomatic F#
There's also the WebSharper web framework. WebSharper isn't ASP.NET with F#, it's its own idiomatic thing. What's that really mean, "idiomatic?"
You know how when you Google Translate a sentence it doesn't quite work? I mean, it works, but it doesn't feel right. It doesn't feel right because the translator understands the words, and some phrases, but not the idioms - the underlying thoughts that are unique to that language. There was a time a few years back when folks were constantly looking for C# to VB convertors. This is something that's quite possible, almost line for line. However, changing an imperative language into a functional one is not like turning American English into British English. ;) Let functional languages be functional.
F# people like to do things their way and the language has very different goals and ideas than C# so it makes sense there would be a opinionated web framework for F#. I like it.
(Although I'm sure there will be a way to use ASP.NET 5 and MVC with F# in the future, this post isn't about that.)
WebSharper has a VS Extension so you can File New new projects, and here's a hello world ToDo List app (minus the HTML view, which you can see here)
namespace UINextApplication1
open WebSharper
open WebSharper.JavaScript
open WebSharper.JQuery
open WebSharper.UI.Next
open WebSharper.UI.Next.Notation
[]
module Client =
type IndexTemplate = Templating.Template<"index.html">
let Tasks = ListModel.FromSeq ["Have breakfast"]
let Main =
JQuery.Of("#tasks").Empty().Ignore
let newName = Var.Create ""
IndexTemplate.Main.Doc(
ListContainer =
(ListModel.View Tasks |> Doc.Convert (fun name ->
IndexTemplate.ListItem.Doc(
Task = View.Const name,
Done = (fun e -> Tasks.Remove name)))
),
Task = newName,
Add = (fun e ->
Tasks.Add(newName.Value)
Var.Set newName "")
)
|> Doc.RunById "tasks"
More interesting is the recent blog post by Adam Granicz where he expands on my "Suave to Azure via GitHub" prototype and shows how to deploy a real F# WebShaprter app to Azure Websites via GitHub.
One of the main improvements is that my solution used FAKE and I found myself wanting a binary version of the FSharp compiler as NuGet. An issue was open and closed within days, simplifying the deployment. Additionally their WebSharper solution creates an ASP.NET app that runs in the context of ASP.NET and IIS, while my Suave solution needed a separate process. WebSharper 3.1 was recently released, and you can see their sample running live in Azure here: http://websharper-clientserver.azurewebsites.net
And of course, you can deploy it to Azure right from here using the Deploy to Azure button!
Do you dabble in F#, are you doing F# professionally? What do you think about F#-based web applications?
Sponsor: Big thanks to Atalasoft for sponsoring the blog and feed this week! If your company works with documents, definitely check out Atalasoft's developer tools for web & mobile viewing, capture, and transformation. They've got free trials and a remarkable support team, too.
© 2015 Scott Hanselman. All rights reserved.