~/talk

Free monad or tagless final? How not to commit to a monad too early

Talkat Scala.IO 2017 · 2017-11-02..11-03· [functional-programming]
slides:none on file

Claim: free monad and tagless final are equally expressive but trade off representation and ergonomics. Live‑coding converts a Future‑based loyalty‑points example into a free monad = programs as data implementation with a Future interpreter run via foldMap to interpret into Future, and into a tagless final = expressions parameterized by F version that requires a Monad constraint for flatMap. Shows interpreter code, combination-of-algebras boilerplate for coproducts, allocation and stack‑safety differences, and gives guidelines: free for librarylike descriptions, tagless for high‑level business code.

AI-written summary · about

  1. 0:00Intro
  2. 1:08Scala code
  3. 15:10Future interpreter
  4. 16:10Find user ID
  5. 17:10Run program description
  6. 18:10Free monad solution
  7. 19:10Tagless final solution
  8. 21:10Making it work
  9. 22:10Comparing to original code
  10. 23:10Writing future interpreter
  11. 24:10Running future interpreter
  12. 25:10Stack safety
  13. 27:10Side effects
  14. 33:10Interpretation
  15. 34:10Summary
  16. 35:10Playing values
  17. 36:10Overhead
  18. 37:10Combining languages
  19. 38:10Free monad guidelines
  20. 39:10Tagless vs free
~/search
type to search 6,249 conferences, 138,987 speakers and 185,172 talks
~/help
cmdctrl k
search every conference, speaker and series
/
focus the filter search
h
home
c
conferences
s
speakers
e
series
t
light / dark — the status bar button does the same
?
this help
esc
close this, then clear every filter — or just the search, while you are typing in it

Ignored while you are typing. Pages without a filter rail have no search to focus.