Successfully reported this slideshow.
Your SlideShare is downloading. ×

FSharp eye for the Haskell guy - London 2015

Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Ad
Loading in …3
×

Check these out next

1 of 35 Ad

More Related Content

Slideshows for you (20)

Viewers also liked (20)

Advertisement

Similar to FSharp eye for the Haskell guy - London 2015 (20)

Advertisement

Recently uploaded (20)

FSharp eye for the Haskell guy - London 2015

  1. 1. F# eye for the Haskell weenie Phillip Trelford, @ptrelford London Haskell, 2015
  2. 2. F# • Statically Typed • Functional First • Object Oriented • Open Source • Cross Platform • In Visual Studio & Xamarin Studio & Emacs & Vim & Atom & ..
  3. 3. F# Influences // OCaml + Python like light syntax let dist (x1,y1) (x2,y2) = let x = x1 - x2 in let y = y2 - y1 in sqrt (x * x + y * y) // & C# dot-driven development let trim (s:string) = s.Trim() F# OCaml Python C#
  4. 4. Miranda Haskell Haskell Miranda Type Classes Monads Change of syntax for type declarations — Miranda bool ::= True | False string == [char] becomes in Haskell data Bool = False | True type String = [Char] Some History of Functional Programming Languages, Turner
  5. 5. F# Community Phillip Trelford, @ptrelford London Haskell, 2015
  6. 6. F#unctional Londoners • meetup.com/fsharplondon • 1000+ Members • Meets every 2 weeks • Topics • Machine Learning • Finance • Games • Art • Cloud • Web
  7. 7. F# Software Foundation http://www.fsharp.org software stacks trainings teaching F# user groups snippets mac and linux cross-platform books and tutorials F# community open-source MonoDevelop contributions research support consultancy mailing list
  8. 8. F# Testimonials order of magnitude increase in productivity GameSys performance is 10× better than the C++ that it replaces Aviva I am still waiting for the first bug to come in E-On Source: fsharp.org/testimonials
  9. 9. F# startups: Jet.com $570M raised
  10. 10. Onikira – Demon Killer: available on Steam
  11. 11. Live Demos: Bread & Butter stuff Phil Trelford, @ptrelford F# eye for the Haskell weenie
  12. 12. Functions let rec fact x = if x < 1 then 1 else x * fact (x - 1) let rec fib = function | 0 -> 0 | 1 -> 1 | n -> fib(n - 1) + fib(n - 2) [1..3] |> List.map ((+)1) let inline map xs = List.map xs map ((+)1) [1..3]
  13. 13. Sum types Type definition type Shape = | Circle of radius:float | Rectangle of width:float * height:float Pattern matching match shape with | Circle(r) -> 2.0 * r | Rectangle(_, h) -> h
  14. 14. Active Patterns let (|FormulaText|_|) (s:string) = if s.StartsWith "=" then Some(s.Substring(1)) else None let (|NumberValue|_|) (s:string) = match System.Decimal.TryParse(s) with | true, n -> Some(n) | false, _ -> None let parse = function | FormulaText text -> Formula text | NumberValue n -> Number n | _ -> invalidOp "Unexpected text"
  15. 15. Live Demos: Familiar concepts Phillip Trelford, @ptrelford London Haskell, 2015
  16. 16. packages |> map • Cabal -> Paket • Shake -> Fake • Parsec -> FParsec • QuickCheck -> FsCheck • HappStack -> Suave • gchjs -> WebSharper • Idris -> F*
  17. 17. Turtle Computation Expression let british = turtle { LIFT THE PEN UP WALK 4 STEPS TURN 3 GRADATIONS TO THE RIGHT PICK THE GREEN PEN PUT THE PEN DOWN DO AS leonardo LIFT THE PEN UP WALK 4 STEPS PICK THE RED PEN PUT THE PEN DOWN REPEAT 3 TIMES WHAT leonardo DOES }
  18. 18. M-Brace cloud Computation Expression
  19. 19. Operator overloading let (<*>><) a b = a + " approves " + b "Fish" <*>>< "custom operators!"
  20. 20. Elm’s Mario Tutorial in F# with FunScript
  21. 21. Pointless free programming let step dir mario = mario |> physics |> walk dir |> gravity |> jump dir let step dir = physics >> walk dir >> gravity >> jump dir
  22. 22. Live Demos: Type Providers Phillip Trelford, @ptrelford London Haskell, 2015
  23. 23. Type providers: JSON open FSharp.Data type Simple = JsonProvider<""" { "name":"John", "age":94 } """> let simple = Simple.GetSample() simple.Age
  24. 24. R – TYPE PROVIDER
  25. 25. World bank data with FunScript
  26. 26. Live Demos: Apps & Games Phillip Trelford, @ptrelford London Haskell, 2015
  27. 27. Cross Platform Games Path to Go | XBLA Pissed off Owls| iOS Pool | WebGL
  28. 28. http://tinyurl.com/funbasi c FUN BASIC - WINDOWS STORE APP
  29. 29. Live Debugging
  30. 30. Profiling with YourKit
  31. 31. Resources Phillip Trelford, @ptrelford London Haskell, 2015
  32. 32. Meet the F#ers on Twitter: #fsharp @rickasaurus @tomaspetricek @jonharrop
  33. 33. #FsAdvent#FSharp
  34. 34. Buy the Book
  35. 35. Questions or Pub? • Twitter • @ptrelford • Blog • http://trelford.com/blog

Editor's Notes

  • “extreme confidence in their own productivity is a hallmark of LISP Weenies and Insufferable Haskell Pricks”-  http://sdtimes.com/code-watch-functional-programmings-smugness-problem/#ixzz3sL5eeHWo 

    https://www.quora.com/Why-is-Haskell-considered-such-a-nice-and-great-language-yet-is-not-being-used

    https://www.quora.com/Functional-Programming/Which-of-Haskell-and-OCaml-is-more-practical
  • http://www.cs.kent.ac.uk/people/staff/dat/tfp12/tfp12.pdf
  • http://techgroup.jet.com/index.html
    https://www.crunchbase.com/organization/jet#/entity
  • http://store.steampowered.com/app/310850/
  • https://twitter.com/leebeattie/status/660005167337730048
  • http://www.pirrmann.net/fun-with-turtles/
  • https://twitter.com/tomaspetricek/status/408301566559412224
  • https://sergeytihon.wordpress.com/2015/10/25/f-advent-calendar-in-english-2015/

×