Typeclasses in JavaScript

Typeclasses in JavaScript

Think Typeclasses are only for developers in Statically Typed languages like Haskell? Think again. With a focus on JavaScript, we'll show how easy it can be to add this superpower to your favorite dynamic language.

97b6ab7f472930954c145ea8080b5742?s=128

Charles Lowell

March 29, 2018
Tweet

Transcript

  1. @cowboyd Hi

  2. @cowboyd I’m Charles I write lots of JavaScript

  3. @cowboyd Frontside https://frontside.io

  4. @cowboyd Love / Hate Relationship

  5. @cowboyd Super Dynamic Super Mutable

  6. @cowboyd Functions, Closures, Assorted Fun

  7. @cowboyd “Multi Paradigmatic”

  8. @cowboyd Object Polymorphism

  9. @cowboyd Object Polymorphism * observable.map() * array.map()

  10. @cowboyd Object Polymorphism The bad parts

  11. @cowboyd Object Polymorphism * Pollutes prototypes * Clashes with potential

    keys * No unifying interface
  12. @cowboyd But Yay Functions!

  13. @cowboyd FP == Functions?

  14. @cowboyd I guess?

  15. @cowboyd Enter Haskell

  16. @cowboyd Bounce!

  17. @cowboyd Time Passes

  18. @cowboyd Bounce!

  19. @cowboyd Learned Emacs LISP

  20. @cowboyd Bounce!

  21. @cowboyd I read Haskellbook https://haskellbook.com

  22. @cowboyd Stick!

  23. @cowboyd Polymorphic Functions Mind = Blown!

  24. @cowboyd Typeclasses Mind = Blown!

  25. @cowboyd WANT!!

  26. @cowboyd But JavaScript :(

  27. @cowboyd Other Options?

  28. @cowboyd Purescript?

  29. @cowboyd Clojurescript?

  30. @cowboyd Elm?

  31. @cowboyd Limited Ecosystems

  32. @cowboyd Hard sell to clients and co-workers

  33. @cowboyd But JavaScript !!

  34. @cowboyd Javascript + Haskell

  35. @cowboyd Javascript + Haskell More that Lodash/FP

  36. @cowboyd Javascript + Haskell More than Ramda

  37. @cowboyd Javascript + Haskell Typeclasses

  38. @cowboyd Javascript + Haskell Polymorphic Functions

  39. @cowboyd Javascript + Haskell Fewer Functions more operands

  40. @cowboyd Funcadelic.js https://github.com/cowboyd/funcadelic.js

  41. @cowboyd Funcadelic.js Category Theory and Typeclasses for Every day JavaScript

    development
  42. @cowboyd

  43. @cowboyd Funcadelic.js Functional Programming is Fun!

  44. @cowboyd How Polymorphic Functions in JavaScript??

  45. @cowboyd Delegate!

  46. @cowboyd Example: Semigroup

  47. @cowboyd

  48. @cowboyd {x: 1} prototype {y: 2} Semigroup append()

  49. @cowboyd

  50. @cowboyd Typeclass instance really is an instance!!

  51. @cowboyd Demo

  52. @cowboyd Other Mentionables

  53. @cowboyd Lazy

  54. @cowboyd Immutable

  55. @cowboyd Referential Transparency

  56. @cowboyd Referential Transparency

  57. @cowboyd

  58. @cowboyd Thanks!