Introduction to F#
Michael Yeaney, Minitab, Inc.
Who Am I?
● Research Architect at Minitab, Inc.
● Focus on distributed systems (cloud apps)
o Scale/Consistency
o Security
● Provable code/systems junkie
o How do you know a system is behaving correctly?
F#....from Microsoft?
● Functional Language (based on OCaml)
● Focus on “pure” FP first, then OO concepts
● Ideal for certain problem sets
o Scientific/stateless
o Pure Logic
● Awesome for modeling
o Works for any domain
o Great for provers/solvers
Benefits
● Access to .NET framework / ecosystem
● Interoperability with any CLR language
o Can be used to cross “language” barriers
● Available cross-platform
o Windows via .NET Framework / VS
o Linux/OS-X via Mono Framework / Xamarin
o Emacs / Vim, too!!!
Features...
● First-class support of functions as values
● Immutability *by default*
o Opt-in to mutation
● Algebraic Types
● Actor-based model of concurrency
● Type providers
Features: Functions as values
● Functions are treated just as any value
● Partial application
● Composition
Features: Immutability
● Assigned values *cannot* be changed
● However….local shadowing is a thing :-(
● That said...avoids a whole set of problems
o Allows certain performance advantages
Features: Algebraic Types
● Combine (compose) types
● Encode type rules completely in...types. :-
o Types are not classes!!!
● Allows use of discriminated union types
o Quite powerful; hard to express better
● Yields _provable_ code
Features: Actor Model
● Built-in actor model
● Allows lightweight concurrency
● Far more scalable than threads/processes
o Erlang/Akka/etc.
● Not quite as transparent as OTP
o Cross-machine is still quite explicit.
o Frameworks help (FSharp.CloudAgent, Cricket)
Features: Type Providers
● New to F# 3.0
● Provide type information
(methods/properties) from external data
sources
● Many built-in providers available OOB:
o OData, WSDL, SQL, CSV
● Create custom type providers
Great stuff!!! Now what?
● Download!!!! [fsharp.org]
● Learn!!! [fsharp.org]
● Psst….[fsharp.org]
● Use a little...integrate into .NET projects
● Use a lot...entire project in F#
● Not using .NET
o Expose via STDIN/OUT….TCP socket….HTTP(S)
Thank You!!!

Introduction to f#

  • 1.
    Introduction to F# MichaelYeaney, Minitab, Inc.
  • 2.
    Who Am I? ●Research Architect at Minitab, Inc. ● Focus on distributed systems (cloud apps) o Scale/Consistency o Security ● Provable code/systems junkie o How do you know a system is behaving correctly?
  • 3.
    F#....from Microsoft? ● FunctionalLanguage (based on OCaml) ● Focus on “pure” FP first, then OO concepts ● Ideal for certain problem sets o Scientific/stateless o Pure Logic ● Awesome for modeling o Works for any domain o Great for provers/solvers
  • 4.
    Benefits ● Access to.NET framework / ecosystem ● Interoperability with any CLR language o Can be used to cross “language” barriers ● Available cross-platform o Windows via .NET Framework / VS o Linux/OS-X via Mono Framework / Xamarin o Emacs / Vim, too!!!
  • 5.
    Features... ● First-class supportof functions as values ● Immutability *by default* o Opt-in to mutation ● Algebraic Types ● Actor-based model of concurrency ● Type providers
  • 6.
    Features: Functions asvalues ● Functions are treated just as any value ● Partial application ● Composition
  • 7.
    Features: Immutability ● Assignedvalues *cannot* be changed ● However….local shadowing is a thing :-( ● That said...avoids a whole set of problems o Allows certain performance advantages
  • 8.
    Features: Algebraic Types ●Combine (compose) types ● Encode type rules completely in...types. :- o Types are not classes!!! ● Allows use of discriminated union types o Quite powerful; hard to express better ● Yields _provable_ code
  • 9.
    Features: Actor Model ●Built-in actor model ● Allows lightweight concurrency ● Far more scalable than threads/processes o Erlang/Akka/etc. ● Not quite as transparent as OTP o Cross-machine is still quite explicit. o Frameworks help (FSharp.CloudAgent, Cricket)
  • 10.
    Features: Type Providers ●New to F# 3.0 ● Provide type information (methods/properties) from external data sources ● Many built-in providers available OOB: o OData, WSDL, SQL, CSV ● Create custom type providers
  • 11.
    Great stuff!!! Nowwhat? ● Download!!!! [fsharp.org] ● Learn!!! [fsharp.org] ● Psst….[fsharp.org] ● Use a little...integrate into .NET projects ● Use a lot...entire project in F# ● Not using .NET o Expose via STDIN/OUT….TCP socket….HTTP(S)
  • 12.