haskell overview
play

Haskell Overview David Grisham 31 October 2017 Haskell Overview - PowerPoint PPT Presentation

Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Haskell Overview David Grisham 31 October 2017 Haskell Overview David Grisham Properties Ecosystem History My Haskell Projects Why care


  1. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Haskell – Overview David Grisham 31 October 2017 Haskell – Overview David Grisham

  2. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Properties Haskell – Overview David Grisham

  3. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Outline • Polymorphically statically typed • Lazy • Purely functional Haskell – Overview David Grisham

  4. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Type System • Polymorphic • Static typing • Strong typing Haskell – Overview David Grisham

  5. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Type System Polymorphism 1 Parametric polymorphism • Unconstrained type variables • e.g. id :: a -> a 2 Ad-hoc polymorphism • Constrained type variables • e.g. sort :: Ord a => [a] -> [a] Haskell – Overview David Grisham

  6. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Type System Static typing • Type-checking happens at compile time • Efficient • No runtime type-checks • Known memory requirements Haskell – Overview David Grisham

  7. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Type System Strong typing • No implicit type conversions. . . • . . . but does have type inference and polymorphism Haskell – Overview David Grisham

  8. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Lazy • Evaluation only when needed > x = 1 `div` 0 > print x *** Exception: divide by zero Haskell – Overview David Grisham

  9. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Lazy Advantages • Save computation time • More modular and expressive Disadvantages • Memory usage less predictable • Might slow down execution Haskell – Overview David Grisham

  10. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Purely Functional • Pure : prohibits side effects • Functions operating on immutable data • Referential transparency • Lazy evaluation Haskell – Overview David Grisham

  11. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Ecosystem Haskell – Overview David Grisham

  12. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Tools • GHC • Stack Haskell – Overview David Grisham

  13. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading GHC • Standard compiler for Haskell • Simon Peyton Jones, Simon Marlow Haskell – Overview David Grisham

  14. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Stack • Development environment for Haskell • Package management, testing, . . . Haskell – Overview David Grisham

  15. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading History Haskell – Overview David Grisham

  16. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading From the man himself. . . Click Haskell – Overview David Grisham

  17. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading My Haskell Projects Haskell – Overview David Grisham

  18. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Elements of Computing Systems • Compiler for Jack (Java-like language) • Jack → VM • VM → assembly language • Only group using Haskell • Python, Java, Ruby, . . . Haskell – Overview David Grisham

  19. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Compiler: Benefits of Haskell • Parsec (‘Parser combinators’) • Build complex parsers from simple ones • Practical intro to more esoteric Haskell • Relatively minimal Haskell knowledge • Result still fairly robust Haskell – Overview David Grisham

  20. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Imperative Language Interpreter • Direct execution (instead of compiling) • Expressiveness exec (IfStmt condition stmt1 stmt2) env | condition = exec stmt1 env | otherwise = exec stmt2 env Haskell – Overview David Grisham

  21. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Other Projects • Decoy routing • Game-theoretic simulation • Movie suggestion script • Filter movies based on genre/etc. • Spit out random movie from result • Todo-list manager • Add task, schedule task, . . . • taskwarrior Haskell – Overview David Grisham

  22. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Why care about Haskell? Haskell – Overview David Grisham

  23. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading XKCD Haskell – Overview David Grisham

  24. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Motivation • Expressive • Fewer runtime bugs • Easier to debug • Easier to maintain • Code reuse Haskell – Overview David Grisham

  25. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Worst practices should be difficult • Sensible defaults in Haskell • Maybe / Nothing over NULL / None • Immutability • Minimal IO Haskell – Overview David Grisham

  26. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Programming Paradigm • Informs how you think about coding • Very useful to broaden • Better code in other languages Haskell – Overview David Grisham

  27. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Coming Up With Haskell Projects Challenge isn’t “what can I do in Haskell” Challenge is “how can I do X in Haskell” Haskell – Overview David Grisham

  28. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Further Reading Haskell – Overview David Grisham

  29. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Links (articles) • Beating the Averages • Competitive advantage in programming language choice • Worst practice should be hard • Long-term language productivity Haskell – Overview David Grisham

  30. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Links (paper and talk) • Von Neumann vs. Functional Languages • First 10 pages, more if you want • Functional Programming Design Patterns • Straightforward explanations of functional advantages Haskell – Overview David Grisham

  31. Properties Ecosystem History My Haskell Projects Why care about Haskell? Further Reading Links (learning resources) • Real World Haskell • Brian O’Sullvian, et al. • Stanford 240h: Functional Systems in Haskell • David Mazieres and Brian O’Sullvian • All resources available (except lecture vids) • /r/haskell • Consistently worthwhile content here Haskell – Overview David Grisham

Recommend


More recommend