SlideShare ist ein Scribd-Unternehmen logo
1 von 34
Downloaden Sie, um offline zu lesen
FunScript 
F# to JavaScript with type providers 
What is FunScript?
FunScript 
F# to JavaScript with type providers 
FunScript is... 
yet another JavaScript compiler 
So why bother?
FunScript 
F# to JavaScript with type providers 
It seems as if every programming language 
in the world compiles now to JavaScript 
And many of them are functional 
o Elm 
o LiveScript 
o PureScript 
o Fay 
So, why bother with FunScript? 
Reason #1...
FunScript 
F# to JavaScript with type providers 
THERE’S A F#er 
WITHIN YOU 
AND YOU KNOW IT
FunScript 
F# to JavaScript with type providers 
Free as in beer! 
F# is a mature, open source, cross-platform, 
functional-first programming language. 
but also multi-paradigm 
F# runs on Linux, Mac OS X, Android, iOS, 
Windows as well as HTML 5 and GPUs. 
And we all know when sth wants to conquerthe whole world is always a good thing 
But enough of sales pitch!
FunScript 
F# to JavaScript with type providers 
SHOW ME DA GOODIES
FunScript 
F# to JavaScript with type providers 
Write F# client-side code in powerful IDEs 
with autocomplete and tooltips 
Intellisense is addictive! 
No plugin required!
FunScript 
F# to JavaScript with type providers 
F# compiler is your best friend 
It helps you write better code by pointing out your mistakes 
If it were a human I would kill it 
...but it’s not!
FunScript 
F# to JavaScript with type providers 
Usual functional stuff 
• First-class and higher-order functions 
• Immutability 
• Recursion 
• Pattern matching 
• Type inference 
Type safety 
without the hassle
FunScript 
F# to JavaScript with type providers 
Functional data structures 
• Tuples 
• Records 
• Discriminated Unions (Option built-in) 
• Classes and Modules 
• Functional collections 
o Recursive lists 
o Map 
o Set 
o seq 
Never type 
IEnumerable 
again!
FunScript 
F# to JavaScript with type providers 
.NET mutable collections 
• Array 
• ResizeArray (mutable List) 
• Dictionary They’ll compile as JS arrays and POJOs, 
so they’re compatible with browser code
FunScript 
F# to JavaScript with type providers 
FunScript is compatible with many methods 
of most used .NET classes 
• Regular Expressions 
• DateTime / TimeSpan 
• String Formatting 
• WebRequest Am I the only one with trouble 
to remember how to use Regex 
and Dates in each platform?
FunScript 
F# to JavaScript with type providers 
.NET Regular Expressions usage example
FunScript 
F# to JavaScript with type providers 
Click here for 
a wonderful talk 
F# unique features 
o Type providers! 
o Units of measure 
o Computation expressions
FunScript 
F# to JavaScript with type providers 
And with FunScript.HTML extensions 
you can create HTML 5 web apps 
using your F#/.NET skills 
Like...
FunScript 
F# to JavaScript with type providers 
Functional Reactive Programming (1) 
Every element has 
an equivalent extension 
property to generate 
an IObservable
FunScript 
F# to JavaScript with type providers 
Functional Reactive Programming (2) 
Internal state
FunScript 
F# to JavaScript with type providers 
Functional Reactive Programming (and 3) 
DateTime 
String formatting 
These extension methods 
can easily be implemented 
for other platforms
FunScript 
F# to JavaScript with type providers 
Asynchronous workflows (1) 
Share types with LINQ to SQL, Web API and client code 
LINQ, Web API and 
FunScript do the tedious 
marshaling work for you
FunScript 
F# to JavaScript with type providers 
Asynchronous workflows (2) 
Asynchronous workflows are also very good 
to handle events as you can use them 
to represent a state-machine 
Forget about “Inversion of Control” 
Take the program flow control back!
FunScript 
F# to JavaScript with type providers 
Asynchronous workflows (and 3) 
No flags needed!
FunScript 
F# to JavaScript with type providers 
Some people 
still like 
JS event 
handling 
though
FunScript 
F# to JavaScript with type providers 
So FunScript and FunScript.HTML 
extensions allow you to: 
o Minimize errors 
o Reuse code 
And most importantly... 
o Reuse your skills
FunScript 
F# to JavaScript with type providers 
This is great. But... 
There are wonderful JS libraries out there 
Do I have to renounce to use them? 
Nope! 
FunScript offers wrappers for all definitions 
in the TypeScript repository through NuGet
FunScript 
F# to JavaScript with type providers
FunScript 
F# to JavaScript with type providers 
FunScript.HTML also offers deeper 
integration with a great JavaScript 
MVC framework: 
Ractive.js 
Check its wonderful website 
to know more
FunScript 
F# to JavaScript with type providers 
Encapsulate state Async for events 
and state updates
FunScript 
F# to JavaScript with type providers 
If necessary, you can extend FunScript 
yourself easily
FunScript 
F# to JavaScript with type providers 
To be fair, there is also another F# 
to JavaScript compiler out there: 
WebSharper, a fantastic project 
by IntelliFactory 
Unlike FunScript, WebSharper is a 
full-fledged web framework 
A more detailed comparison follows.
FunScript 
F# to JavaScript with type providers 
Oh, c’mon! 
FUNSCRIPT 
FEATURES 
Everything 
you just saw 
WEBSHARPER 
FEATURES 
Sorry, I haven’t 
used it. Please 
visit their site 
and judge yourself
FunScript 
F# to JavaScript with type providers 
This is coming to an end 
SAYONARA 
BABY 
That’s what he said in the Spanish version
FunScript 
F# to JavaScript with type providers 
FunScript has been created by Zach Bray 
and several bright minds from the 
F# community have contributed to it 
▪ Tomas Petricek 
▪ Robert Pickering 
▪ James Freiwirth 
Doesn’t it sound 
like a Marvel 
Hero name? 
...more at funscript.info
FunScript 
F# to JavaScript with type providers 
And this presentation has been 
assembled by yours truly, 
Alfonso García-Caro 
@alfonsogcnunez 
github.com/alfonsogarciacaro 
So now... 
I’m also a 
collaborator 
now, but I’m 
more of a 
freeloader
FunScript 
F# to JavaScript with type providers 
WHAT THE 
HELL ARE YOU 
WAITING FOR

Weitere ähnliche Inhalte

Was ist angesagt?

Python Intro For Managers
Python Intro For ManagersPython Intro For Managers
Python Intro For Managers
Atul Shridhar
 

Was ist angesagt? (20)

IL2CPP: Debugging and Profiling
IL2CPP: Debugging and ProfilingIL2CPP: Debugging and Profiling
IL2CPP: Debugging and Profiling
 
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
 
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
Daniele Esposti - Evolution or stagnation programming languages - Codemotion ...
 
Introduction To Python
Introduction To PythonIntroduction To Python
Introduction To Python
 
AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8AOT-compilation of JavaScript with V8
AOT-compilation of JavaScript with V8
 
Python Intro For Managers
Python Intro For ManagersPython Intro For Managers
Python Intro For Managers
 
Writing Fast Code - PyCon HK 2015
Writing Fast Code - PyCon HK 2015Writing Fast Code - PyCon HK 2015
Writing Fast Code - PyCon HK 2015
 
Introduction to Go programming
Introduction to Go programmingIntroduction to Go programming
Introduction to Go programming
 
C++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTER
C++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTERC++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTER
C++ TRAINING IN AMBALA CANTT! BATRA COMPUTER CENTER
 
Why we need functions in c
Why we need functions in cWhy we need functions in c
Why we need functions in c
 
Php Vs Phyton
Php Vs PhytonPhp Vs Phyton
Php Vs Phyton
 
From Python to smartphones: neural nets @ Saint-Gobain, François Sausset
From Python to smartphones: neural nets @ Saint-Gobain, François SaussetFrom Python to smartphones: neural nets @ Saint-Gobain, François Sausset
From Python to smartphones: neural nets @ Saint-Gobain, François Sausset
 
Using Aspects for Language Portability (SCAM 2010)
Using Aspects for Language Portability (SCAM 2010)Using Aspects for Language Portability (SCAM 2010)
Using Aspects for Language Portability (SCAM 2010)
 
How to contribute textual tooling for apache camel in several id es
How to contribute textual tooling for apache camel in several id esHow to contribute textual tooling for apache camel in several id es
How to contribute textual tooling for apache camel in several id es
 
Happy hacking with Plone
Happy hacking with PloneHappy hacking with Plone
Happy hacking with Plone
 
Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language Lets Go - An introduction to Google's Go Programming Language
Lets Go - An introduction to Google's Go Programming Language
 
A First Look at Google's Go Programming Language
A First Look at Google's Go Programming LanguageA First Look at Google's Go Programming Language
A First Look at Google's Go Programming Language
 
The Spoofax Language Workbench (SPLASH 2010)
The Spoofax Language Workbench (SPLASH 2010)The Spoofax Language Workbench (SPLASH 2010)
The Spoofax Language Workbench (SPLASH 2010)
 
Intro dotnet
Intro dotnetIntro dotnet
Intro dotnet
 
Ruby formatters
Ruby formattersRuby formatters
Ruby formatters
 

Ähnlich wie FunScript: Why bother?

Developing mobile apps with f sharp
Developing mobile apps with f sharpDeveloping mobile apps with f sharp
Developing mobile apps with f sharp
Gustavo Guerra
 

Ähnlich wie FunScript: Why bother? (20)

Madrid F# Meetup: Introduction to F#
Madrid F# Meetup: Introduction to F#Madrid F# Meetup: Introduction to F#
Madrid F# Meetup: Introduction to F#
 
TypeScript
TypeScriptTypeScript
TypeScript
 
vpTech - Practical F# in Finance
vpTech - Practical F# in FinancevpTech - Practical F# in Finance
vpTech - Practical F# in Finance
 
Domain Modeling & Full-Stack Web Development F#
Domain Modeling & Full-Stack Web Development F#Domain Modeling & Full-Stack Web Development F#
Domain Modeling & Full-Stack Web Development F#
 
Migrating Web SDK from JS to TS
Migrating Web SDK from JS to TSMigrating Web SDK from JS to TS
Migrating Web SDK from JS to TS
 
TypeScript VS JavaScript.pptx
TypeScript VS JavaScript.pptxTypeScript VS JavaScript.pptx
TypeScript VS JavaScript.pptx
 
Bay NET Aug 19 2009 presentation ppt
Bay  NET Aug 19 2009 presentation pptBay  NET Aug 19 2009 presentation ppt
Bay NET Aug 19 2009 presentation ppt
 
How F# Learned to Stop Worrying and Love the Data
How F# Learned to Stop Worrying and Love the DataHow F# Learned to Stop Worrying and Love the Data
How F# Learned to Stop Worrying and Love the Data
 
Developing mobile apps with f sharp
Developing mobile apps with f sharpDeveloping mobile apps with f sharp
Developing mobile apps with f sharp
 
TypeScript: What to do with types in JavaScript
TypeScript: What to do with types in JavaScriptTypeScript: What to do with types in JavaScript
TypeScript: What to do with types in JavaScript
 
Cross-Platform Native Apps with JavaScript
Cross-Platform Native Apps with JavaScriptCross-Platform Native Apps with JavaScript
Cross-Platform Native Apps with JavaScript
 
My 10 favorite Haxe language features - Francis Bourre - Codemotion Rome 2017
My 10 favorite Haxe language features - Francis Bourre - Codemotion Rome 2017My 10 favorite Haxe language features - Francis Bourre - Codemotion Rome 2017
My 10 favorite Haxe language features - Francis Bourre - Codemotion Rome 2017
 
COMPUTER LANGUAGES AND THERE DIFFERENCE
COMPUTER LANGUAGES AND THERE DIFFERENCE COMPUTER LANGUAGES AND THERE DIFFERENCE
COMPUTER LANGUAGES AND THERE DIFFERENCE
 
Type script vs javascript come face to face in battleground
Type script vs javascript come face to face in battlegroundType script vs javascript come face to face in battleground
Type script vs javascript come face to face in battleground
 
Swift vs. Language X
Swift vs. Language XSwift vs. Language X
Swift vs. Language X
 
Dmitry mozorov on code quotations code as-data for f#
Dmitry mozorov on code quotations code as-data for f#Dmitry mozorov on code quotations code as-data for f#
Dmitry mozorov on code quotations code as-data for f#
 
The ES6 Conundrum - All Things Open 2015
The ES6 Conundrum - All Things Open 2015The ES6 Conundrum - All Things Open 2015
The ES6 Conundrum - All Things Open 2015
 
Practical F#
Practical F#Practical F#
Practical F#
 
F# Tutorial @ QCon
F# Tutorial @ QConF# Tutorial @ QCon
F# Tutorial @ QCon
 
Notes (2012-06-08)
Notes (2012-06-08)Notes (2012-06-08)
Notes (2012-06-08)
 

Kürzlich hochgeladen

Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
A Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source MilvusA Beginners Guide to Building a RAG App Using Open Source Milvus
A Beginners Guide to Building a RAG App Using Open Source Milvus
 
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
Apidays Singapore 2024 - Scalable LLM APIs for AI and Generative AI Applicati...
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Ransomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdfRansomware_Q4_2023. The report. [EN].pdf
Ransomware_Q4_2023. The report. [EN].pdf
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

FunScript: Why bother?

  • 1. FunScript F# to JavaScript with type providers What is FunScript?
  • 2. FunScript F# to JavaScript with type providers FunScript is... yet another JavaScript compiler So why bother?
  • 3. FunScript F# to JavaScript with type providers It seems as if every programming language in the world compiles now to JavaScript And many of them are functional o Elm o LiveScript o PureScript o Fay So, why bother with FunScript? Reason #1...
  • 4. FunScript F# to JavaScript with type providers THERE’S A F#er WITHIN YOU AND YOU KNOW IT
  • 5. FunScript F# to JavaScript with type providers Free as in beer! F# is a mature, open source, cross-platform, functional-first programming language. but also multi-paradigm F# runs on Linux, Mac OS X, Android, iOS, Windows as well as HTML 5 and GPUs. And we all know when sth wants to conquerthe whole world is always a good thing But enough of sales pitch!
  • 6. FunScript F# to JavaScript with type providers SHOW ME DA GOODIES
  • 7. FunScript F# to JavaScript with type providers Write F# client-side code in powerful IDEs with autocomplete and tooltips Intellisense is addictive! No plugin required!
  • 8. FunScript F# to JavaScript with type providers F# compiler is your best friend It helps you write better code by pointing out your mistakes If it were a human I would kill it ...but it’s not!
  • 9. FunScript F# to JavaScript with type providers Usual functional stuff • First-class and higher-order functions • Immutability • Recursion • Pattern matching • Type inference Type safety without the hassle
  • 10. FunScript F# to JavaScript with type providers Functional data structures • Tuples • Records • Discriminated Unions (Option built-in) • Classes and Modules • Functional collections o Recursive lists o Map o Set o seq Never type IEnumerable again!
  • 11. FunScript F# to JavaScript with type providers .NET mutable collections • Array • ResizeArray (mutable List) • Dictionary They’ll compile as JS arrays and POJOs, so they’re compatible with browser code
  • 12. FunScript F# to JavaScript with type providers FunScript is compatible with many methods of most used .NET classes • Regular Expressions • DateTime / TimeSpan • String Formatting • WebRequest Am I the only one with trouble to remember how to use Regex and Dates in each platform?
  • 13. FunScript F# to JavaScript with type providers .NET Regular Expressions usage example
  • 14. FunScript F# to JavaScript with type providers Click here for a wonderful talk F# unique features o Type providers! o Units of measure o Computation expressions
  • 15. FunScript F# to JavaScript with type providers And with FunScript.HTML extensions you can create HTML 5 web apps using your F#/.NET skills Like...
  • 16. FunScript F# to JavaScript with type providers Functional Reactive Programming (1) Every element has an equivalent extension property to generate an IObservable
  • 17. FunScript F# to JavaScript with type providers Functional Reactive Programming (2) Internal state
  • 18. FunScript F# to JavaScript with type providers Functional Reactive Programming (and 3) DateTime String formatting These extension methods can easily be implemented for other platforms
  • 19. FunScript F# to JavaScript with type providers Asynchronous workflows (1) Share types with LINQ to SQL, Web API and client code LINQ, Web API and FunScript do the tedious marshaling work for you
  • 20. FunScript F# to JavaScript with type providers Asynchronous workflows (2) Asynchronous workflows are also very good to handle events as you can use them to represent a state-machine Forget about “Inversion of Control” Take the program flow control back!
  • 21. FunScript F# to JavaScript with type providers Asynchronous workflows (and 3) No flags needed!
  • 22. FunScript F# to JavaScript with type providers Some people still like JS event handling though
  • 23. FunScript F# to JavaScript with type providers So FunScript and FunScript.HTML extensions allow you to: o Minimize errors o Reuse code And most importantly... o Reuse your skills
  • 24. FunScript F# to JavaScript with type providers This is great. But... There are wonderful JS libraries out there Do I have to renounce to use them? Nope! FunScript offers wrappers for all definitions in the TypeScript repository through NuGet
  • 25. FunScript F# to JavaScript with type providers
  • 26. FunScript F# to JavaScript with type providers FunScript.HTML also offers deeper integration with a great JavaScript MVC framework: Ractive.js Check its wonderful website to know more
  • 27. FunScript F# to JavaScript with type providers Encapsulate state Async for events and state updates
  • 28. FunScript F# to JavaScript with type providers If necessary, you can extend FunScript yourself easily
  • 29. FunScript F# to JavaScript with type providers To be fair, there is also another F# to JavaScript compiler out there: WebSharper, a fantastic project by IntelliFactory Unlike FunScript, WebSharper is a full-fledged web framework A more detailed comparison follows.
  • 30. FunScript F# to JavaScript with type providers Oh, c’mon! FUNSCRIPT FEATURES Everything you just saw WEBSHARPER FEATURES Sorry, I haven’t used it. Please visit their site and judge yourself
  • 31. FunScript F# to JavaScript with type providers This is coming to an end SAYONARA BABY That’s what he said in the Spanish version
  • 32. FunScript F# to JavaScript with type providers FunScript has been created by Zach Bray and several bright minds from the F# community have contributed to it ▪ Tomas Petricek ▪ Robert Pickering ▪ James Freiwirth Doesn’t it sound like a Marvel Hero name? ...more at funscript.info
  • 33. FunScript F# to JavaScript with type providers And this presentation has been assembled by yours truly, Alfonso García-Caro @alfonsogcnunez github.com/alfonsogarciacaro So now... I’m also a collaborator now, but I’m more of a freeloader
  • 34. FunScript F# to JavaScript with type providers WHAT THE HELL ARE YOU WAITING FOR