SlideShare a Scribd company logo
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Data-First Online Functional
Programming with F#
Adam Granicz, CEO, IntelliFactory
@granicz, @websharper, @cloudsharper
http://fpish.net/blog/adam.granicz/all/0
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Huge thanks to our sponsors & partners!
Premium community conference on Microsoft technologies itcampro@ itcamp14#
4x F# MVP – 2010-2014
(Most Valuable Professional)
Coauthor of 4 F# books, 3 of
them with Don Syme, the
designer of F#
CEO of IntelliFactory,
The F# Company
Regular speaker in numerous
conferences and developer
workshops
About me
Steering Committee member
of the Commercial Users of
Functional Programming
(CUFP) workshop,
representing F#
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Expert F# - 2007
Expert F# 2.0 – 2010
Visual Studio 2010 and .NET 4 Six-in-One – 2010
Expert F# 3.0 – 2012
F# Books I coauthored
Premium community conference on Microsoft technologies itcampro@ itcamp14#
How to do
interactive,
data-driven,
web programming
In an online development environment that
enables quick data exploration and
visualization
In this talk you will learn about
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Why F#?
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Functional core language
Powerful functional abstractions
Functional data structures
Immutability
Cool features
Active patterns
Units of measure
Type Providers
Object-orientation to interoperate with other
.NET languages
Why F#?
Premium community conference on Microsoft technologies itcampro@ itcamp14#
FSharp.Data – provides quick, type-safe
access to all sorts of data sources
CSV files
Relational databases
REST data sources
World Bank database
Freebase databases
etc.
Type Providers
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Mature, enterprise-ready framework
Write all your server+client code in F#
Get a complete web or mobile application
Interface with any client-side JS library via F#
Powerful functional abstractions
Automatic resource management
Safe URLs, type-safe URLs
and much-much more…
WebSharper
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Open source project, available at:
https://bitbucket.org/IntelliFactory/websharper
Dual licensed for closed source use
Dedicated support – new features, bugfix
releases
WebSharper
Premium community conference on Microsoft technologies itcampro@ itcamp14#
open IntelliFactory.WebSharper
module Server =
[<Rpc>]
let MyServerFunction(...) = ...
module Client =
[<JavaScript>]
let MyClientFunction(...) =
...
let v = MyServerFunction(...)
...
Bridging the language mismatch
Premium community conference on Microsoft technologies itcampro@ itcamp14#
WebSharper
What do I get with WebSharper?
1. Automatic resource management
=> no need to include dependencies by hand
=> each page loads only the resources it needs
2. Type-safe access to JavaScript libraries via F#
=> dozens of extensions available (visualizations, charts, …)
=> has its own eDSL for describing JavaScript APIs
=> TypeScript type provider (in supported version)
Premium community conference on Microsoft technologies itcampro@ itcamp14#
WebSharper
What do I get with WebSharper?
3. Uniform programming model (everything is F#)
=> write all server and client code in F#
4. Client-Server applications
=> [<JavaScript>] vs [<Rpc>] annotations
=> Seamless communication via RPC
=> No need to worry about how to pass data
Premium community conference on Microsoft technologies itcampro@ itcamp14#
WebSharper
What do I get with WebSharper?
5. Composable functional programming
abstractions
=> Pagelets: to represent dynamic markup and behavior
=> Sitelets: to represent web applications
=> Formlets: to represent complex and dependent
web forms
=> Flowlets: to represent sequences of user forms,
wizzards
Premium community conference on Microsoft technologies itcampro@ itcamp14#
WebSharper sitelets
• Type-safe
• Composable
• First-class
Parameterized over a union type:
type Action =
| Home
| Contact
| Protected
| Login of option<Action>
| Logout
| Echo of string
Representing web applications as values
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Sitelets – dynamic templating
Runtime-checked, safe URLs
module Skin =
type Page = { Body : Content.HtmlElement list }
let MainTemplate =
let path = Path.Combine(__SOURCE_DIRECTORY__, "Main.html")
Content.Template<Page>(path)
.With("body", fun x -> x.Body)
let WithTemplate body : Content<Action> =
Content.WithTemplate MainTemplate <| fun context ->
{ Body = body context }
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Composing web applications from smaller ones
let EntireSite =
let home = Sitelet.Content ...
let authenticated = Sitelet.Protect filter <| ...
let basic = Sitelet.Infer <| fun action -> ...
Sitelet.Sum
[
home
authenticated
basic
]
Representing web applications as values
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Binding JavaScript libraries
eDSL to describe JavaScript APIs
Type Provider for TypeScript definitions
F#
WebSharper
extension
TypeScript
TypeScript
Type Provider
WebSharper
extension
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Describing client-side
APIs in F# via
WebSharper
Interface
Generator (WIG)
Binding JavaScript libraries
Premium community conference on Microsoft technologies itcampro@ itcamp14#
namespace IntelliFactory.WebSharper.Facebook
module Definition =
...
let FB =
Class "FB"
|+> [ ...
"login" => ...
"getLoginStatus" => ...
"api" => ...
]
|> Requires [Res.FacebookAPI]
let Assembly =
Assembly [
Namespace
"IntelliFactory.WebSharper.Facebook" [
...; FB
] ...
]
Binding JavaScript libraries
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Binding JavaScript libraries
Defining classes – useful operators
let FlashHidingArgs =
Class "FB.FlashHidingArgs"
|+> Protocol [
"state" =? T<string>
"elem" =? T<Element>
]
=? : Member
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Binding JavaScript libraries
Defining optional members
let InitOptions =
Pattern.Config "FB.InitOptions" {
Required = []
Optional =
[
"appId", T<string>
"cookie", T<bool>
...
"hideFlashCallback", FlashHidingArgs ^-> T<unit>
]
}
• Typical in most JavaScript libraries
• Used heavily in configuration objects
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Binding JavaScript libraries
Describing client-side
APIs via
TypeScript
declarations
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Binding JavaScript libraries
Defining safe enumerations
let UserStatus =
Pattern.EnumStrings "FB.UserStatus"
["connected"; "not_authorized"; "unknown"]
• Typical in most JavaScript libraries
• Used heavily in configuration objects
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Type Provider for TypeScript definitions
type Facebook =
IntelliFactory.TypeScript.Generator<"Facebook.d.ts">
Facebook.***
Binding JavaScript libraries
Premium community conference on Microsoft technologies itcampro@ itcamp14#
CloudSharper
Premium community conference on Microsoft technologies itcampro@ itcamp14#
What is CloudSharper?
An online integrated development environment
(IDE) for developing web and mobile applications.
Language neutral - can be used with any language
First phase targets .NET (F#) development
F# - full language support
C# - not yet, but coming
JavaScript – full language support
Syntax highlighting for dozens of languages
Premium community conference on Microsoft technologies itcampro@ itcamp14#
What is CloudSharper?
An online, cloud-hosted IDE
with interactive exploration
and
An SaaS platform for
developing and running
applications
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Enables you to develop, deploy, and run full web and
mobile applications with interactive programming
CloudSharper
Premium community conference on Microsoft technologies itcampro@ itcamp14#
What is CloudSharper?
Multi-project solutions with full build support
Web and mobile applications
On-the-fly type checking
Integration with data and other providers
Interactive data exploration, REPL
Premium community conference on Microsoft technologies itcampro@ itcamp14#
It’s extensible
… even with full applications
It can be configured
… with custom renderers
… with custom editors
What is CloudSharper?
Premium community conference on Microsoft technologies itcampro@ itcamp14#
CloudSharper
Has three “screens” to help you navigate better:
Dashboard: Account settings, Templates/Workspaces
Workspace: Your current project
Deploy: Once built, you can preview your project
Premium community conference on Microsoft technologies itcampro@ itcamp14#
The Workspace view
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Charting and Visualization
Built in support for Ext
JS charting via a native
F# API in Interactive
Works with any other
JavaScript visualization
and charting library
through WebSharper
extensions
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Documenting projects
Full markdown support,
and documentation via
README.*.md, with
multiple code formatters.
Coming up: Full
ApiStack.net integration –
generating and
integrating full API
references within
CloudSharper.
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Developing mobile applications
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Developing mobile applications
Accessing native mobile capabilities
GPS, Camera, Accelerometer, Calls,
Contacts, …
1. PhoneGap Cordova for WebSharper
2. Some features are available in HTML5
Geolocation, local storage, etc.
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Developing mobile applications
Packaging for Android/iOS/WP/etc.
1. WebSharper Mobile
Has basic support for building/packaging for
Android and Windows Phone, but no iOS/etc.
2. PhoneGap Build
An online service to build for all kinds of mobile platforms.
Premium community conference on Microsoft technologies itcampro@ itcamp14#
… Demo …
Interactive programming in CloudSharper
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Aggregates and catalogs FP content about:
Q&A
Events/Conferences
Courses
User Groups
Blogs
Jobs
Developers
etc…
FPish.net
Premium community conference on Microsoft technologies itcampro@ itcamp14#
Q & A
Get in touch
@granicz @cloudsharper @websharper @fpishnet
http://cloudsharper.com
http://websharper.com
http://intellifactory.com
http://fpish.net
http://www.facebook.com/intellifactory

More Related Content

PDF
ITCamp 2013 - Adam Granicz - Developing for W8 with F# and WebSharper
PPT
OSCON Titanium Tutorial
PPTX
Introduction to Apache Cordova (Phonegap)
PDF
[2015/2016] Apache Cordova
PDF
Cordova: APIs and instruments
PPTX
Features of java unit 1
PDF
Apache cordova
PDF
Hithhiker guide to eclipse presentation frameworks galaxy
ITCamp 2013 - Adam Granicz - Developing for W8 with F# and WebSharper
OSCON Titanium Tutorial
Introduction to Apache Cordova (Phonegap)
[2015/2016] Apache Cordova
Cordova: APIs and instruments
Features of java unit 1
Apache cordova
Hithhiker guide to eclipse presentation frameworks galaxy

What's hot (15)

PDF
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSS
PDF
Architecting iOS Project
ODP
Plug yourself in and your app will never be the same (2 hour edition)
PDF
Apache Cordova
PDF
J introtojava1-pdf
PDF
ITCamp 2013 - Raffaele Rialdi - Windows Runtime (WinRT) deep dive
PDF
ITCamp 2013 - Lorant Domokos - Chasing the one codebase, multiple platforms d...
PPT
J2ee strutswithhibernate-140121221332-phpapp01
PDF
Cordova + Ionic + MobileFirst
PPTX
3.0 Introduction to .NET Framework
PPT
Programming in c#
ODP
Jalimo Slides Linuxtag2008
PDF
GitHub halp app - Minimizing platform-specific code with MVVM - Justin Spahr-...
PDF
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
ODP
Lotusphere 2011 Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...
Cordova / PhoneGap, mobile apps development with HTML5/JS/CSS
Architecting iOS Project
Plug yourself in and your app will never be the same (2 hour edition)
Apache Cordova
J introtojava1-pdf
ITCamp 2013 - Raffaele Rialdi - Windows Runtime (WinRT) deep dive
ITCamp 2013 - Lorant Domokos - Chasing the one codebase, multiple platforms d...
J2ee strutswithhibernate-140121221332-phpapp01
Cordova + Ionic + MobileFirst
3.0 Introduction to .NET Framework
Programming in c#
Jalimo Slides Linuxtag2008
GitHub halp app - Minimizing platform-specific code with MVVM - Justin Spahr-...
The how-dare-you-call-me-an-idiot’s guide to the .NET Standard (NDC London 2017)
Lotusphere 2011 Jmp103 - Jumpstart Your "Jedi Plug-in Development Skills" wi...
Ad

Viewers also liked (6)

PDF
ITCamp 2011 - Raul Andrisan - What’s new in Silverlight 5
PDF
ITCamp 2012 - Alessandro Teglia - Community open panel
PDF
The Roslyn Compiler: Look at Your Code from a Different Perspective (Raffaele...
PDF
ITCamp 2012 - Sergiu Damian - Architectural decisions on the battlefield
PDF
ITCamp 2012 - Dan Fizesan - Serving 10 million requests per day
PDF
SQL Server 2014 for Developers (Cristian Lefter)
ITCamp 2011 - Raul Andrisan - What’s new in Silverlight 5
ITCamp 2012 - Alessandro Teglia - Community open panel
The Roslyn Compiler: Look at Your Code from a Different Perspective (Raffaele...
ITCamp 2012 - Sergiu Damian - Architectural decisions on the battlefield
ITCamp 2012 - Dan Fizesan - Serving 10 million requests per day
SQL Server 2014 for Developers (Cristian Lefter)
Ad

Similar to Data-First Online Functional Programming with F# (Adam Granicz) (20)

PDF
ITCamp 2013 - Petru Jucovschi - Application ecosystems
PDF
ITCamp 2013 - Melania Danciu - HTML5 apps with LightSwitch
PDF
Developing for Windows Phone 8.1 (Dan Ardelean)
PPTX
Developing for Windows Phone 8.1
PPT
Visual Studio .NET2010
PDF
Elements of DDD with ASP.NET MVC & Entity Framework Code First v2
PPTX
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
PPS
Silverlight Demos For Beginners
PPTX
PHP and Silverlight
PDF
Mihai Tataran - Building Windows 8 Applications with HTML5 and JS
PDF
Ten compelling reasons to learn .net framework
PDF
How # (sharp) is Your Katana (Ciprian Jichici)
PDF
ITCamp 2011 - Melania Danciu - Mobile apps
PDF
CLR_via_CSharp_(Jeffrey_Richter_4th_Edition).pdf
PDF
The New Era of Code in the Cloud (Bogdan Toporan)
PDF
Busy Developers Guide to AngularJS (Tiberiu Covaci)
PDF
Top 11 Front-End Web Development Tools To Consider in 2020
PPTX
UX@Vitra - Experience Continuum
PPTX
CCI 2017 - Introduzione a SharePoint Framework (SPFx) - Fabio Franzini
PPTX
Serverless Single Page Apps with React and Redux at ItCamp 2017
ITCamp 2013 - Petru Jucovschi - Application ecosystems
ITCamp 2013 - Melania Danciu - HTML5 apps with LightSwitch
Developing for Windows Phone 8.1 (Dan Ardelean)
Developing for Windows Phone 8.1
Visual Studio .NET2010
Elements of DDD with ASP.NET MVC & Entity Framework Code First v2
MS Day EPITA 2010: Visual Studio 2010 et Framework .NET 4.0
Silverlight Demos For Beginners
PHP and Silverlight
Mihai Tataran - Building Windows 8 Applications with HTML5 and JS
Ten compelling reasons to learn .net framework
How # (sharp) is Your Katana (Ciprian Jichici)
ITCamp 2011 - Melania Danciu - Mobile apps
CLR_via_CSharp_(Jeffrey_Richter_4th_Edition).pdf
The New Era of Code in the Cloud (Bogdan Toporan)
Busy Developers Guide to AngularJS (Tiberiu Covaci)
Top 11 Front-End Web Development Tools To Consider in 2020
UX@Vitra - Experience Continuum
CCI 2017 - Introduzione a SharePoint Framework (SPFx) - Fabio Franzini
Serverless Single Page Apps with React and Redux at ItCamp 2017

More from ITCamp (20)

PDF
ITCamp 2019 - Stacey M. Jenkins - Protecting your company's data - By psychol...
PDF
ITCamp 2019 - Silviu Niculita - Supercharge your AI efforts with the use of A...
PDF
ITCamp 2019 - Peter Leeson - Managing Skills
PPTX
ITCamp 2019 - Mihai Tataran - Governing your Cloud Resources
PDF
ITCamp 2019 - Ivana Milicic - Color - The Shadow Ruler of UX
PDF
ITCamp 2019 - Florin Coros - Implementing Clean Architecture
PPTX
ITCamp 2019 - Florin Loghiade - Azure Kubernetes in Production - Field notes...
PPTX
ITCamp 2019 - Florin Flestea - How 3rd Level support experience influenced m...
PPTX
ITCamp 2019 - Emil Craciun - RoboRestaurant of the future powered by serverle...
PPTX
ITCamp 2019 - Eldert Grootenboer - Cloud Architecture Recipes for The Enterprise
PPTX
ITCamp 2019 - Cristiana Fernbach - Blockchain Legal Trends
PPTX
ITCamp 2019 - Andy Cross - Machine Learning with ML.NET and Azure Data Lake
PPTX
ITCamp 2019 - Andy Cross - Business Outcomes from AI
PDF
ITCamp 2019 - Andrea Saltarello - Modernise your app. The Cloud Story
PDF
ITCamp 2019 - Andrea Saltarello - Implementing bots and Alexa skills using Az...
PPTX
ITCamp 2019 - Alex Mang - I'm Confused Should I Orchestrate my Containers on ...
PPTX
ITCamp 2019 - Alex Mang - How Far Can Serverless Actually Go Now
PDF
ITCamp 2019 - Peter Leeson - Vitruvian Quality
PDF
ITCamp 2018 - Ciprian Sorlea - Million Dollars Hello World Application
PDF
ITCamp 2018 - Ciprian Sorlea - Enterprise Architectures with TypeScript And F...
ITCamp 2019 - Stacey M. Jenkins - Protecting your company's data - By psychol...
ITCamp 2019 - Silviu Niculita - Supercharge your AI efforts with the use of A...
ITCamp 2019 - Peter Leeson - Managing Skills
ITCamp 2019 - Mihai Tataran - Governing your Cloud Resources
ITCamp 2019 - Ivana Milicic - Color - The Shadow Ruler of UX
ITCamp 2019 - Florin Coros - Implementing Clean Architecture
ITCamp 2019 - Florin Loghiade - Azure Kubernetes in Production - Field notes...
ITCamp 2019 - Florin Flestea - How 3rd Level support experience influenced m...
ITCamp 2019 - Emil Craciun - RoboRestaurant of the future powered by serverle...
ITCamp 2019 - Eldert Grootenboer - Cloud Architecture Recipes for The Enterprise
ITCamp 2019 - Cristiana Fernbach - Blockchain Legal Trends
ITCamp 2019 - Andy Cross - Machine Learning with ML.NET and Azure Data Lake
ITCamp 2019 - Andy Cross - Business Outcomes from AI
ITCamp 2019 - Andrea Saltarello - Modernise your app. The Cloud Story
ITCamp 2019 - Andrea Saltarello - Implementing bots and Alexa skills using Az...
ITCamp 2019 - Alex Mang - I'm Confused Should I Orchestrate my Containers on ...
ITCamp 2019 - Alex Mang - How Far Can Serverless Actually Go Now
ITCamp 2019 - Peter Leeson - Vitruvian Quality
ITCamp 2018 - Ciprian Sorlea - Million Dollars Hello World Application
ITCamp 2018 - Ciprian Sorlea - Enterprise Architectures with TypeScript And F...

Recently uploaded (20)

PPT
Teaching material agriculture food technology
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
The Rise and Fall of 3GPP – Time for a Sabbatical?
PDF
Agricultural_Statistics_at_a_Glance_2022_0.pdf
PDF
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
PDF
Encapsulation theory and applications.pdf
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
PPTX
Programs and apps: productivity, graphics, security and other tools
PPTX
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
A comparative analysis of optical character recognition models for extracting...
PDF
gpt5_lecture_notes_comprehensive_20250812015547.pdf
PDF
Electronic commerce courselecture one. Pdf
DOCX
The AUB Centre for AI in Media Proposal.docx
PDF
Spectral efficient network and resource selection model in 5G networks
PPTX
Spectroscopy.pptx food analysis technology
PDF
Dropbox Q2 2025 Financial Results & Investor Presentation
PDF
MIND Revenue Release Quarter 2 2025 Press Release
PDF
Review of recent advances in non-invasive hemoglobin estimation
Teaching material agriculture food technology
Digital-Transformation-Roadmap-for-Companies.pptx
The Rise and Fall of 3GPP – Time for a Sabbatical?
Agricultural_Statistics_at_a_Glance_2022_0.pdf
Profit Center Accounting in SAP S/4HANA, S4F28 Col11
Encapsulation theory and applications.pdf
Diabetes mellitus diagnosis method based random forest with bat algorithm
Build a system with the filesystem maintained by OSTree @ COSCUP 2025
Programs and apps: productivity, graphics, security and other tools
VMware vSphere Foundation How to Sell Presentation-Ver1.4-2-14-2024.pptx
Chapter 3 Spatial Domain Image Processing.pdf
A comparative analysis of optical character recognition models for extracting...
gpt5_lecture_notes_comprehensive_20250812015547.pdf
Electronic commerce courselecture one. Pdf
The AUB Centre for AI in Media Proposal.docx
Spectral efficient network and resource selection model in 5G networks
Spectroscopy.pptx food analysis technology
Dropbox Q2 2025 Financial Results & Investor Presentation
MIND Revenue Release Quarter 2 2025 Press Release
Review of recent advances in non-invasive hemoglobin estimation

Data-First Online Functional Programming with F# (Adam Granicz)

  • 1. Premium community conference on Microsoft technologies itcampro@ itcamp14#
  • 2. Premium community conference on Microsoft technologies itcampro@ itcamp14# Data-First Online Functional Programming with F# Adam Granicz, CEO, IntelliFactory @granicz, @websharper, @cloudsharper http://fpish.net/blog/adam.granicz/all/0
  • 3. Premium community conference on Microsoft technologies itcampro@ itcamp14# Huge thanks to our sponsors & partners!
  • 4. Premium community conference on Microsoft technologies itcampro@ itcamp14# 4x F# MVP – 2010-2014 (Most Valuable Professional) Coauthor of 4 F# books, 3 of them with Don Syme, the designer of F# CEO of IntelliFactory, The F# Company Regular speaker in numerous conferences and developer workshops About me Steering Committee member of the Commercial Users of Functional Programming (CUFP) workshop, representing F#
  • 5. Premium community conference on Microsoft technologies itcampro@ itcamp14# Expert F# - 2007 Expert F# 2.0 – 2010 Visual Studio 2010 and .NET 4 Six-in-One – 2010 Expert F# 3.0 – 2012 F# Books I coauthored
  • 6. Premium community conference on Microsoft technologies itcampro@ itcamp14# How to do interactive, data-driven, web programming In an online development environment that enables quick data exploration and visualization In this talk you will learn about
  • 7. Premium community conference on Microsoft technologies itcampro@ itcamp14# Why F#?
  • 8. Premium community conference on Microsoft technologies itcampro@ itcamp14# Functional core language Powerful functional abstractions Functional data structures Immutability Cool features Active patterns Units of measure Type Providers Object-orientation to interoperate with other .NET languages Why F#?
  • 9. Premium community conference on Microsoft technologies itcampro@ itcamp14# FSharp.Data – provides quick, type-safe access to all sorts of data sources CSV files Relational databases REST data sources World Bank database Freebase databases etc. Type Providers
  • 10. Premium community conference on Microsoft technologies itcampro@ itcamp14# Mature, enterprise-ready framework Write all your server+client code in F# Get a complete web or mobile application Interface with any client-side JS library via F# Powerful functional abstractions Automatic resource management Safe URLs, type-safe URLs and much-much more… WebSharper
  • 11. Premium community conference on Microsoft technologies itcampro@ itcamp14# Open source project, available at: https://bitbucket.org/IntelliFactory/websharper Dual licensed for closed source use Dedicated support – new features, bugfix releases WebSharper
  • 12. Premium community conference on Microsoft technologies itcampro@ itcamp14# open IntelliFactory.WebSharper module Server = [<Rpc>] let MyServerFunction(...) = ... module Client = [<JavaScript>] let MyClientFunction(...) = ... let v = MyServerFunction(...) ... Bridging the language mismatch
  • 13. Premium community conference on Microsoft technologies itcampro@ itcamp14# WebSharper What do I get with WebSharper? 1. Automatic resource management => no need to include dependencies by hand => each page loads only the resources it needs 2. Type-safe access to JavaScript libraries via F# => dozens of extensions available (visualizations, charts, …) => has its own eDSL for describing JavaScript APIs => TypeScript type provider (in supported version)
  • 14. Premium community conference on Microsoft technologies itcampro@ itcamp14# WebSharper What do I get with WebSharper? 3. Uniform programming model (everything is F#) => write all server and client code in F# 4. Client-Server applications => [<JavaScript>] vs [<Rpc>] annotations => Seamless communication via RPC => No need to worry about how to pass data
  • 15. Premium community conference on Microsoft technologies itcampro@ itcamp14# WebSharper What do I get with WebSharper? 5. Composable functional programming abstractions => Pagelets: to represent dynamic markup and behavior => Sitelets: to represent web applications => Formlets: to represent complex and dependent web forms => Flowlets: to represent sequences of user forms, wizzards
  • 16. Premium community conference on Microsoft technologies itcampro@ itcamp14# WebSharper sitelets • Type-safe • Composable • First-class Parameterized over a union type: type Action = | Home | Contact | Protected | Login of option<Action> | Logout | Echo of string Representing web applications as values
  • 17. Premium community conference on Microsoft technologies itcampro@ itcamp14# Sitelets – dynamic templating Runtime-checked, safe URLs module Skin = type Page = { Body : Content.HtmlElement list } let MainTemplate = let path = Path.Combine(__SOURCE_DIRECTORY__, "Main.html") Content.Template<Page>(path) .With("body", fun x -> x.Body) let WithTemplate body : Content<Action> = Content.WithTemplate MainTemplate <| fun context -> { Body = body context }
  • 18. Premium community conference on Microsoft technologies itcampro@ itcamp14# Composing web applications from smaller ones let EntireSite = let home = Sitelet.Content ... let authenticated = Sitelet.Protect filter <| ... let basic = Sitelet.Infer <| fun action -> ... Sitelet.Sum [ home authenticated basic ] Representing web applications as values
  • 19. Premium community conference on Microsoft technologies itcampro@ itcamp14# Binding JavaScript libraries eDSL to describe JavaScript APIs Type Provider for TypeScript definitions F# WebSharper extension TypeScript TypeScript Type Provider WebSharper extension
  • 20. Premium community conference on Microsoft technologies itcampro@ itcamp14# Describing client-side APIs in F# via WebSharper Interface Generator (WIG) Binding JavaScript libraries
  • 21. Premium community conference on Microsoft technologies itcampro@ itcamp14# namespace IntelliFactory.WebSharper.Facebook module Definition = ... let FB = Class "FB" |+> [ ... "login" => ... "getLoginStatus" => ... "api" => ... ] |> Requires [Res.FacebookAPI] let Assembly = Assembly [ Namespace "IntelliFactory.WebSharper.Facebook" [ ...; FB ] ... ] Binding JavaScript libraries
  • 22. Premium community conference on Microsoft technologies itcampro@ itcamp14# Binding JavaScript libraries Defining classes – useful operators let FlashHidingArgs = Class "FB.FlashHidingArgs" |+> Protocol [ "state" =? T<string> "elem" =? T<Element> ] =? : Member
  • 23. Premium community conference on Microsoft technologies itcampro@ itcamp14# Binding JavaScript libraries Defining optional members let InitOptions = Pattern.Config "FB.InitOptions" { Required = [] Optional = [ "appId", T<string> "cookie", T<bool> ... "hideFlashCallback", FlashHidingArgs ^-> T<unit> ] } • Typical in most JavaScript libraries • Used heavily in configuration objects
  • 24. Premium community conference on Microsoft technologies itcampro@ itcamp14# Binding JavaScript libraries Describing client-side APIs via TypeScript declarations
  • 25. Premium community conference on Microsoft technologies itcampro@ itcamp14# Binding JavaScript libraries Defining safe enumerations let UserStatus = Pattern.EnumStrings "FB.UserStatus" ["connected"; "not_authorized"; "unknown"] • Typical in most JavaScript libraries • Used heavily in configuration objects
  • 26. Premium community conference on Microsoft technologies itcampro@ itcamp14# Type Provider for TypeScript definitions type Facebook = IntelliFactory.TypeScript.Generator<"Facebook.d.ts"> Facebook.*** Binding JavaScript libraries
  • 27. Premium community conference on Microsoft technologies itcampro@ itcamp14# CloudSharper
  • 28. Premium community conference on Microsoft technologies itcampro@ itcamp14# What is CloudSharper? An online integrated development environment (IDE) for developing web and mobile applications. Language neutral - can be used with any language First phase targets .NET (F#) development F# - full language support C# - not yet, but coming JavaScript – full language support Syntax highlighting for dozens of languages
  • 29. Premium community conference on Microsoft technologies itcampro@ itcamp14# What is CloudSharper? An online, cloud-hosted IDE with interactive exploration and An SaaS platform for developing and running applications
  • 30. Premium community conference on Microsoft technologies itcampro@ itcamp14# Enables you to develop, deploy, and run full web and mobile applications with interactive programming CloudSharper
  • 31. Premium community conference on Microsoft technologies itcampro@ itcamp14# What is CloudSharper? Multi-project solutions with full build support Web and mobile applications On-the-fly type checking Integration with data and other providers Interactive data exploration, REPL
  • 32. Premium community conference on Microsoft technologies itcampro@ itcamp14# It’s extensible … even with full applications It can be configured … with custom renderers … with custom editors What is CloudSharper?
  • 33. Premium community conference on Microsoft technologies itcampro@ itcamp14# CloudSharper Has three “screens” to help you navigate better: Dashboard: Account settings, Templates/Workspaces Workspace: Your current project Deploy: Once built, you can preview your project
  • 34. Premium community conference on Microsoft technologies itcampro@ itcamp14# The Workspace view
  • 35. Premium community conference on Microsoft technologies itcampro@ itcamp14# Charting and Visualization Built in support for Ext JS charting via a native F# API in Interactive Works with any other JavaScript visualization and charting library through WebSharper extensions
  • 36. Premium community conference on Microsoft technologies itcampro@ itcamp14# Documenting projects Full markdown support, and documentation via README.*.md, with multiple code formatters. Coming up: Full ApiStack.net integration – generating and integrating full API references within CloudSharper.
  • 37. Premium community conference on Microsoft technologies itcampro@ itcamp14# Developing mobile applications
  • 38. Premium community conference on Microsoft technologies itcampro@ itcamp14# Developing mobile applications Accessing native mobile capabilities GPS, Camera, Accelerometer, Calls, Contacts, … 1. PhoneGap Cordova for WebSharper 2. Some features are available in HTML5 Geolocation, local storage, etc.
  • 39. Premium community conference on Microsoft technologies itcampro@ itcamp14# Developing mobile applications Packaging for Android/iOS/WP/etc. 1. WebSharper Mobile Has basic support for building/packaging for Android and Windows Phone, but no iOS/etc. 2. PhoneGap Build An online service to build for all kinds of mobile platforms.
  • 40. Premium community conference on Microsoft technologies itcampro@ itcamp14# … Demo … Interactive programming in CloudSharper
  • 41. Premium community conference on Microsoft technologies itcampro@ itcamp14# Aggregates and catalogs FP content about: Q&A Events/Conferences Courses User Groups Blogs Jobs Developers etc… FPish.net
  • 42. Premium community conference on Microsoft technologies itcampro@ itcamp14# Q & A Get in touch @granicz @cloudsharper @websharper @fpishnet http://cloudsharper.com http://websharper.com http://intellifactory.com http://fpish.net http://www.facebook.com/intellifactory