2. Tachyus’ success with F#
Data Access
Web APIs
Handling Exceptions
Managing Builds
Questions
3.
4. ASP.NET Web API hosted in Azure
AngularJS-based SPA providing information to office
workers
iOS application for workers in oil fields
5. Less code
Get things done faster
Type safety
Expressive syntax
Full .NET compatibility
Active, strong community (small but growing!)
6.
7. DbmlFile and SqlDataConnection (LINQ to SQL)
EdmxFile and SqlEntityConnection (Entity Framework)
SQL Provider
FSharp.Data.SqlClient <- we use this one
8. “SQL is the best DSL for working with data”
- Rob Conery, http://www.infoq.com/articles/ORM-Saffron-
Conery
15. F# DSL using System.Net.Http
Headers composition
Follows the natural composition of HTTP
Frank Resources == HTTP Resources
Define your own conventions!
23. “FAKE is a Domain Specific Language that you can use without knowing F#, but if
and when you outgrow it you can keep heading down the F# road. In all cases you've
got all of .NET at your command.”
- Scott Hanselman,
http://www.hanselman.com/blog/ExploringFAKEAnFBuildSystemForAllOfNET.asp
x
24. WebSharper and FunScript – F# -> JavaScript compilers
VegaHub – interactive charting from the F# interactive
window
F# Web Stack – OWIN-based tools for building web APIs
Work in progress to merge Frank + HyperF + Dyfrig + Taliesin
25. F# Software Foundation
Community for F#
Sergey Tihon’s F# Weekly
F# for Fun and Profit
Real World Functional Programming on MSDN
Notes de l'éditeur
Our back end is all F# using Web API and running in Azure.
Our two client applications started in languages native to their target platforms.
The iOS team has almost completed a successful conversion to F# using Xamarin.
We are currently evaluating options to do the same with F# to generate JavaScript and HTML, which should also provide some additional opportunities for code sharing.
I know this is called F# on the web, but really, you want to expose some data, right?
Also, F# is very strong at modeling data flows, so it only makes sense to start at the data layer.
Spaghetti code?
Not this! It’s fully type-checked!
And it generates the types for you, with the same runtime performance as Dapper and other micro ORMs.
Demo!
Exceptions can be a real pain in the neck.
Exceptions tend to bubble back up, requiring you to break all the nice forward-only flows we’ve been writing to this point.
Railway-oriented (or data flow) programming can help resolve the issue and retain the nice flows we are using.
The Async module includes a Catch function that will allow us to partition the changes coming out and handle successes and failures as we progress.